Skip to content

feat(api): stop storing full article content in database #518

feat(api): stop storing full article content in database

feat(api): stop storing full article content in database #518

Workflow file for this run

name: Website container CI/CD
# Build apps into Docker images, push to
# GitHub container registry and deploy
# on host machine.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
on:
push:
branches: ["main"]
paths:
- "web/**"
- "api/**"
- "package.json"
- "package-lock.json"
- "Cargo.toml"
- "Cargo.lock"
- "turbo.json"
- "flake.nix"
- "flake.lock"
workflow_dispatch:
jobs:
files-changed:
name: Detect which files' changed
runs-on: ubuntu-latest
timeout-minutes: 3
# Map a step output to a job output
outputs:
www: ${{ steps.changes.outputs.www }}
backend: ${{ steps.changes.outputs.api }}
migrate: ${{ steps.changes.outputs.migrate }}
# Config related changes that do not require a build but trigger a deploy
deploy: ${{ steps.changes.outputs.deploy }}
steps:
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
token: ${{ github.token }}
filters: |
www:
- "web/**"
- "package.json"
- "package-lock.json"
- "flake.nix"
- "flake.lock"
api:
- "api/src/**"
- "api/Cargo.toml"
- "Cargo.lock"
- "flake.nix"
- "flake.lock"
migrate:
- "prisma/**"
- "package.json"
- "package-lock.json"
- "flake.nix"
- "flake.lock"
build-and-push-www:
name: Build www (Nix)
needs: files-changed
if: ${{ needs.files-changed.outputs.www == 'true' }}
uses: ./.github/workflows/nix.yml
with:
build-command: .#dockerWww
image-name: ghcr.io/wonrax/wrx-sh-www:latest
# Disable sandbox to fetch blog images and precompress them at build time
sandbox: false
build-and-push-backend:
name: Build API (Nix)
needs: [files-changed]
if: ${{ needs.files-changed.outputs.backend == 'true' }}
uses: ./.github/workflows/nix.yml
with:
build-command: .#dockerApi
image-name: ghcr.io/wonrax/wrx-sh-api:latest
# ort-sys (build.rs) fetches libraries from the internet, thus sandbox is disabled
sandbox: false
build-and-push-migrate:
name: Build database migrator (Nix)
needs: files-changed
if: ${{ needs.files-changed.outputs.migrate == 'true' }}
uses: ./.github/workflows/nix.yml
with:
build-command: .#dockerSchemaMigrator
image-name: ghcr.io/wonrax/wrx-sh-migrator:latest
sandbox: true
deploy:
name: Deploy
uses: ./.github/workflows/deploy.yml
needs:
- build-and-push-www
- build-and-push-backend
- build-and-push-migrate
- files-changed
# According to GHA docs, this job won't run if one of its needs is
# skipped. We want to deploy if at least one needed job is successful
# and no jobs fail. We don't care about skipping job because we don't
# want to re-build and re-deploy unchanged code.
# Related links:
# https://docs.github.com/en/actions/learn-github-actions/expressions#failure
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
if: ${{ !failure() && (
needs.build-and-push-backend.result == 'success' ||
needs.build-and-push-www.result == 'success' ||
needs.build-and-push-migrate.result == 'success' ) }}
secrets: inherit