CI #2015
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: CI | |
| on: | |
| push: {} | |
| pull_request: {} | |
| workflow_dispatch: {} | |
| schedule: | |
| - cron: "0 0 * * *" # Every day at 00:00 UTC | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the source code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install Rust | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| - name: Build static website | |
| run: cargo run --release | |
| - name: Upload artifact | |
| if: github.ref == 'refs/heads/master' && github.repository_owner == 'rust-lang' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./output | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' && github.repository_owner == 'rust-lang' | |
| needs: build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 | |
| id: deployment | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
| aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
| aws-region: us-west-1 | |
| - name: Invalidate CloudFront cache | |
| run: aws cloudfront create-invalidation --distribution-id E3URKC86CEGJWE --paths "/*" |