Commit missing OG images on CI #102
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: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: cargo-all-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('crates/**') }} | |
| restore-keys: cargo-all- | |
| - run: cargo check | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: cargo-all-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('crates/**') }} | |
| restore-keys: cargo-all- | |
| - run: cargo test | |
| build-deploy: | |
| name: Build & deploy | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: cargo-ssg-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('crates/**') }} | |
| restore-keys: cargo-ssg- | |
| - run: cargo run -p ssg -- --generate-missing-og-images | |
| env: | |
| FONT_ZIP_URL: "${{ secrets.FONT_ZIP_URL }}" | |
| - uses: stefanzweifel/git-auto-commit-action@v5 | |
| id: commit-og-images | |
| with: | |
| commit_message: "Add missing OG images" | |
| file_pattern: "**/og-image.png" | |
| - uses: nwtgck/actions-netlify@v3.0 | |
| # If we committed new OG images, this will trigger a new deploy, which | |
| # will be more complete, so skip this. | |
| if: steps.commit-og-images.outputs.changes_detected == 'false' | |
| with: | |
| publish-dir: './dist' | |
| production-deploy: true | |
| enable-github-deployment: false | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| - uses: axiomhq/annotation-action@v0.1.0 | |
| # Only if the deployment happened | |
| if: steps.commit-og-images.outputs.changes_detected == 'false' | |
| with: | |
| axiomToken: ${{ secrets.AXIOM_TOKEN}} | |
| datasets: netlify | |
| type: deployment | |
| title: Production deployment | |
| description: ${{ github.event.head_commit.message }} |