-
-
Notifications
You must be signed in to change notification settings - Fork 259
feat: matrix-parallelized multi-language CI/CD architecture with dynamic versioning #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
50e9557
update/workflow with parallel language builds and versioning
AR21SM c472195
update/build_website.sh file
AR21SM 7449a28
Remove/Tag deployment
AR21SM 09a8a68
add/concurrency
AR21SM fc3b279
fix:all remaining changes
AR21SM b700527
Merge branch 'next' into update/build-gh-pages
OriolAbril ce22a76
fix:environmment variable in conf.py
AR21SM d01f398
feat: deploy all languages including hidden ones
AR21SM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,128 @@ | ||
| name: deploy-book | ||
|
|
||
| # Only run this when the main branch changes | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - next | ||
| - main | ||
| - '*-translations' | ||
| - '!1.0-translations' | ||
|
|
||
| concurrency: | ||
| group: "gh-pages" | ||
| cancel-in-progress: true | ||
|
|
||
| # This job installs dependencies, build the book, and pushes it to `gh-pages` | ||
| jobs: | ||
| get-info: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| languages: ${{ steps.get-languages.outputs.languages }} | ||
| version: ${{ steps.version-info.outputs.version }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Get languages directly with jq | ||
| id: get-languages | ||
| run: | | ||
| languages=$(jq -c '[.[] | .code]' DISCOVER/_static/languages.json) | ||
| echo "languages=${languages}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Determine version from GitHub context | ||
| id: version-info | ||
| env: | ||
| REF_NAME: ${{ github.ref_name }} | ||
| REF_TYPE: ${{ github.ref_type }} | ||
| run: | | ||
| version="dev" | ||
| if [[ "$REF_TYPE" == "tag" ]]; then | ||
| version="${REF_NAME#v}" | ||
| elif [[ "$REF_NAME" == *-translations ]]; then | ||
| version="${REF_NAME%-translations}" | ||
| fi | ||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
|
|
||
| deploy-book: | ||
| needs: get-info | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| language: ${{ fromJSON(needs.get-info.outputs.languages) }} | ||
|
AR21SM marked this conversation as resolved.
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python 3.13 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Build documentation with script | ||
| env: | ||
| VERSION: ${{ needs.get-info.outputs.version }} | ||
| LANGUAGE: ${{ matrix.language }} | ||
| run: | | ||
| bash ci/build_website.sh | ||
|
|
||
| - name: Set up Python 3.13 | ||
| uses: actions/setup-python@v1 | ||
| with: | ||
| python-version: 3.13 | ||
| - name: Deploy language to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./DISCOVER/_build/html | ||
| destination_dir: ${{ needs.get-info.outputs.version }}/${{ matrix.language }} | ||
| keep_files: true | ||
|
|
||
| - name: Build the book | ||
| run: | | ||
| bash ci/build_website.sh | ||
| create-redirect: | ||
| needs: [get-info, deploy-book] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Create version redirect | ||
| run: | | ||
| mkdir -p temp_redirect | ||
| cat > temp_redirect/index.html << 'EOF' | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>DISCOVER Cookbook - Redirecting...</title> | ||
| <link rel="canonical" href="./en/"> | ||
| <meta http-equiv="refresh" content="0; url=./en/"> | ||
| </head> | ||
| <body> | ||
| <a href="./en/">Redirecting to English...</a> | ||
| </body> | ||
| </html> | ||
| EOF | ||
|
|
||
| - name: Deploy version redirect | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./temp_redirect | ||
| destination_dir: ${{ needs.get-info.outputs.version }} | ||
| keep_files: true | ||
|
|
||
| deploy-root-files: | ||
| needs: [get-info, deploy-book] | ||
| runs-on: ubuntu-latest | ||
| if: github.ref_name == 'main' | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Create root files directory | ||
| run: | | ||
| mkdir -p root_files | ||
| cp DISCOVER/404.html root_files/ | ||
| cp index.html root_files/ | ||
| cp DISCOVER/_static/versions.json root_files/ | ||
|
|
||
| - name: Push book HTML to gh-pages | ||
| uses: peaceiris/actions-gh-pages@v3.9.0 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./DISCOVER/_build/html | ||
| destination_dir: dev/ | ||
| keep_files: true | ||
| - name: Deploy root files to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./root_files | ||
| destination_dir: . | ||
| keep_files: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,18 @@ | ||
|
|
||
| #!/usr/bin/env bash | ||
| echo "Starting build process..." | ||
|
|
||
| # Get parameters with defaults | ||
| VERSION=${VERSION:-${1:-"dev"}} | ||
| LANGUAGE=${LANGUAGE:-${2:-"en"}} | ||
|
|
||
| echo "Building version: $VERSION, language: $LANGUAGE" | ||
|
|
||
| # Install dependencies | ||
| pip install -r requirements.txt | ||
|
|
||
| # Clean tags directory | ||
| rm -rf DISCOVER/_tags/* | ||
|
|
||
| echo "Building English version..." | ||
| sphinx-build -b html DISCOVER/ DISCOVER/_build/html | ||
|
|
||
|
|
||
| # Copy root level files if they exist | ||
| if [ -f "DISCOVER/_static/404.html" ]; then | ||
| cp DISCOVER/_static/404.html DISCOVER/_build/html/ | ||
| fi | ||
|
|
||
|
|
||
| echo "Build completed successfully" | ||
| echo "Building $LANGUAGE version..." | ||
| WEBSITE_VERSION="$VERSION" WEBSITE_LANGUAGE="$LANGUAGE" sphinx-build -b html DISCOVER/ DISCOVER/_build/html |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.