-
Notifications
You must be signed in to change notification settings - Fork 0
[OPS-510] Overhaul docs building #101
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
19 commits
Select commit
Hold shift + click to select a range
44257ab
Refactor docs building
alourie d97aae3
Clear the docs?...
alourie e9d7787
Fix component name
alourie 6834237
Capitalise deploy parameter to build-docs
alourie b9032cb
Don't tag on npm-app-snapshot
alourie 951152b
Fix download_url
alourie 37b1633
Fix npm-app-release docs deployment
alourie 6e42d41
Fixup npm-lib-release to deploy docs
alourie bc4e54d
Add docs deployment to npm-lib-release
alourie 0d6ee83
Fix gitignore check
alourie 7003da0
Outputs updates
alourie 6e327b0
Update python-lib-snapshot
alourie e3e0e8c
Fix python-build
alourie 034362a
Fix python things
alourie fd5b1ec
Run python check in basic pipeline container
alourie 910fef6
Add check for leaks as python deps
alourie 4fa23cb
More deps for python
alourie 4d8a8b1
fix dependency for python
alourie d717b8c
Finish testing
alourie 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 |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| name: Build Docs | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| DEPLOY: | ||
| description: 'Flag to deploy the docs' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| VERSION: | ||
| description: 'Version to tag the release with' | ||
| required: false | ||
| type: string | ||
| default: "0" | ||
| secrets: | ||
| CI_GITHUB_TOKEN: | ||
| required: true | ||
|
|
||
| outputs: | ||
| artifact-uploaded: | ||
| value: ${{ jobs.build-docs.outputs.artifact-uploaded }} | ||
| product: | ||
| value: ${{ jobs.build-docs.outputs.product }} | ||
| component: | ||
| value: ${{ jobs.build-docs.outputs.component }} | ||
|
|
||
| jobs: | ||
| build-docs: | ||
| runs-on: ubuntu-latest | ||
| container: zepben/pipeline-docusaurus | ||
| outputs: | ||
| artifact-uploaded: ${{ steps.artifact.outputs.uploaded }} | ||
| product: ${{ steps.docs-component.outputs.product }} | ||
| component: ${{ steps.docs-component.outputs.component }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | ||
| DOCS_TITLE: ${{ vars.DOCS_TITLE }} | ||
| PRODUCT: ${{ vars.PRODUCT }} | ||
| steps: | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ env.GITHUB_TOKEN }} | ||
|
|
||
| - name: Work around git permission issue | ||
| run: | | ||
| dname=$(echo ${{github.repository}} | cut -d'/' -f2) | ||
| git config --global --add safe.directory /__w/$dname/$dname | ||
| shell: sh | ||
|
|
||
| - name: Check that DOCS_TITLE and PRODUCT are properly defined in the repo | ||
| run: | | ||
| if [[ -d docs/site-config && -z $DOCS_TITLE ]]; then | ||
| echo "The \$DOCS_TITLE environment variable needs to be set on this repo!" | ||
| exit 1 | ||
| fi | ||
| if [[ ! -z $PRODUCT && $PRODUCT != "evolve" && $PRODUCT != "ednar" ]]; then | ||
| echo "The only supported values for \$PRODUCT environment variable are 'evolve' and 'ednar'! It's currently set to '$PRODUCT'" | ||
| exit 1 | ||
| fi | ||
| shell: bash | ||
|
|
||
| - name: Fetch the document component name | ||
| id: docs-component | ||
| shell: sh {0} | ||
| run: | | ||
| # Figure out the product type | ||
| product=${PRODUCT:-"evolve"} | ||
| echo "product=$product" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| # This is a project/component name, both for the docs slug and for the proper directory under zepben.github.io {product}/docs/{component} | ||
| echo "component=$(echo ${GITHUB_REPOSITORY} | cut -f2 -d\/)" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| - name: Build docusaurus | ||
| id: build | ||
| uses: zepben/docusaurus-action@main | ||
| with: | ||
| VERSION: ${{ inputs.VERSION }} | ||
| NPM_REPO: ${{ secrets.NPM_REPO }} | ||
| NPM_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} | ||
| DOCS_TITLE: ${{ env.DOCS_TITLE }} | ||
| PRODUCT: ${{ env.PRODUCT }} | ||
| continue-on-error: true | ||
|
|
||
| - name: Failed build | ||
| if: steps.build.outcome == 'failure' | ||
| run: | | ||
| echo "There was an error in the docusaurus build above. Docs are not pushed" | ||
| echo " :boom: There was an error in the docusaurus build step. Current docs are not published" >> ${GITHUB_STEP_SUMMARY} | ||
| shell: sh | ||
|
|
||
| - name: Check if we need to skip deployment for hotfix or LTS branch | ||
| if: ${{ inputs.DEPLOY }} | ||
| run: | | ||
| if [[ ${GITHUB_REF_NAME} =~ "hotfix" || ${GITHUB_REF_NAME} =~ "LTS" ]]; then | ||
| echo "deployDocs=no" >> ${GITHUB_ENV} | ||
| echo "Running on LTS or hotfix branch, skip deploying docs" | ||
| else | ||
| echo "deployDocs=yes" >> ${GITHUB_ENV} | ||
| fi | ||
|
|
||
| - name: Zip documentation | ||
| if: ${{ env.deployDocs == 'yes' }} | ||
| run: | | ||
| cd docs/build | ||
| zip -r ../../docs.zip . | ||
| shell: bash | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: ${{ steps.build.outcome == 'success' && env.deployDocs == 'yes' }} | ||
| id: upload | ||
| with: | ||
| name: docs.zip | ||
| path: docs.zip | ||
|
|
||
| - if: ${{ steps.upload.outcome == 'success' }} | ||
| id: artifact | ||
| run: | ||
| echo "uploaded=yes" >> "${GITHUB_OUTPUT}" |
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
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
Oops, something went wrong.
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.