-
Notifications
You must be signed in to change notification settings - Fork 8.1k
ci: split build and publish workflows and set up cache #14768
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
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
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,75 @@ | ||
| name: publish | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - published | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-20.04 | ||
| steps: | ||
| - | ||
| name: Prepare | ||
| run: | | ||
| JEKYLL_ENV=development | ||
| if [ "${{ github.ref }}" = "refs/heads/master" ]; then | ||
| DOCS_S3_HOST="docs.docker.com-stage-us-east-1" | ||
| DOCS_AWS_LAMBDA="arn:aws:lambda:us-east-1:710015040892:function:docs-stage-cache-invalidator" | ||
| DOCS_SLACK_MSG="Successfully promoted docs-stage from master. https://docs-stage.docker.com/" | ||
| DOCS_WEBCONFIG="_website-config-docs-stage.json" | ||
| elif [ "${{ github.ref }}" = "refs/heads/published" ]; then | ||
| JEKYLL_ENV=production | ||
| DOCS_S3_HOST="docs.docker.com-us-east-1" | ||
| DOCS_AWS_LAMBDA="arn:aws:lambda:us-east-1:710015040892:function:docs-cache-invalidator" | ||
| DOCS_SLACK_MSG="Successfully published docs. https://docs.docker.com/" | ||
| DOCS_WEBCONFIG="_website-config-docs.json" | ||
| fi | ||
| echo "JEKYLL_ENV=$JEKYLL_ENV" >> $GITHUB_ENV | ||
| echo "DOCS_S3_HOST=$DOCS_S3_HOST" >> $GITHUB_ENV | ||
| echo "DOCS_AWS_LAMBDA=$DOCS_AWS_LAMBDA" >> $GITHUB_ENV | ||
| echo "DOCS_SLACK_MSG=$DOCS_SLACK_MSG" >> $GITHUB_ENV | ||
| echo "DOCS_WEBCONFIG=$DOCS_WEBCONFIG" >> $GITHUB_ENV | ||
| - | ||
| name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - | ||
| name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
| - | ||
| name: Build | ||
| uses: docker/bake-action@v2 | ||
| with: | ||
| targets: release | ||
| set: | | ||
| *.cache-from=type=gha,scope=publish | ||
| *.cache-to=type=gha,scope=publish,mode=max | ||
| - | ||
| name: Upload files to S3 bucket | ||
| run: | | ||
| aws --region us-east-1 s3 sync --acl public-read _site s3://${{ env.DOCS_S3_HOST }}/ --delete | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| - | ||
| name: Update S3 website config | ||
| uses: ./.github/actions/update-website-config | ||
| with: | ||
| bucketName: ${{ env.DOCS_S3_HOST }} | ||
| regionName: us-east-1 | ||
| websiteConfig: ${{ env.DOCS_WEBCONFIG }} | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| - | ||
| name: Invalidate docs website cache | ||
| run: | | ||
| aws --region us-east-1 lambda invoke --function-name ${{ env.DOCS_AWS_LAMBDA }} response.json | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| - | ||
| name: Send Slack notification | ||
| run: | | ||
| curl -X POST -H 'Content-type: application/json' --data '{"text":"${{ env.DOCS_SLACK_MSG }}"}' ${{ secrets.SLACK_WEBHOOK }} | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps in a follow-up we should consider adding a check-for-broken-links check in this workflow as well, to make sure no links are broken before publishing