Deploy To GitHub Pages #3251
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
name: Deploy To GitHub Pages | |
on: | |
schedule: | |
- cron: '0 22 * * *' | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
env: | |
MDBOOK_VERSION: 0.4.51 | |
RUN_BLACKSMITH: 1 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install mdbook | |
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz | |
- name: Build book | |
run: ./mdbook build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./book/html | |
deploy: | |
if: github.repository_owner == 'rust-lang' | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: deployment | |
uses: actions/deploy-pages@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::890664054962:role/forge-rust-lang-org-ci | |
aws-region: us-east-1 | |
- name: Invalidate CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id E12A3GKHZSREHP --paths "/*" |