Don't skip the deploy if we added og-images #114
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: 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' | |
permissions: | |
# Necessary to commit new OG images | |
contents: write | |
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" | |
disable_globbing: true | |
- uses: nwtgck/[email protected] | |
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/[email protected] | |
with: | |
axiomToken: ${{ secrets.AXIOM_TOKEN}} | |
datasets: netlify | |
type: deployment | |
title: Production deployment | |
description: ${{ github.event.head_commit.message }} |