Deploy To GitHub Pages #2537
This file contains 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 * * *' | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install mdbook | |
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz | |
- name: Check blacksmith format | |
run: cargo fmt --check --manifest-path=blacksmith/Cargo.toml | |
- name: Build book | |
run: ./mdbook build | |
- name: Deploy book | |
uses: rust-lang/simpleinfra/github-actions/static-websites@master | |
with: | |
deploy_dir: book | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
if: github.ref == 'refs/heads/master' | |
- name: Configure AWS credentials | |
if: github.ref == 'refs/heads/master' | |
uses: aws-actions/configure-aws-credentials@v1 | |
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 "/*" | |
if: github.ref == 'refs/heads/master' |