Calio/.forgejo/workflows/build.yml
Elijah 6fc0a01c56
All checks were successful
Verify and publish Calio container / build-and-push (push) Successful in 1m4s
first commit
2026-10-20 19:04:12 -07:00

48 lines
1.7 KiB
YAML

name: Verify and publish Calio container
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-and-push:
if: github.event.deleted != true
runs-on: ubuntu-latest
env:
JOB_IMAGE: calio-ci:${{ github.run_id }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node 24
uses: https://github.com/actions/setup-node@v4
with:
node-version: "24"
- name: Install locked dependencies
run: npm ci --no-audit --no-fund
- name: Run tests
run: npm test
- name: Build application
run: npm run build
- name: Build production container
env:
COMMIT_SHA: ${{ github.sha }}
run: docker build --label "org.opencontainers.image.revision=$COMMIT_SHA" -t "$JOB_IMAGE" .
- name: Smoke test container and persistent data
run: |
node scripts/container-smoke.js "$JOB_IMAGE"
node scripts/container-smoke.js "$JOB_IMAGE" --unraid
- name: Publish image to Forgejo registry
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
env:
FORGEJO_PAT: ${{ secrets.FORGEJO_PAT }}
SOURCE_IMAGE: ${{ env.JOB_IMAGE }}
REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME || github.repository_owner }}
REPOSITORY: ${{ github.repository }}
CI_EVENT: ${{ github.event_name }}
COMMIT_SHA: ${{ github.sha }}
TARGET_REF: ${{ github.ref }}
MAIN_BRANCH: ${{ github.event.repository.default_branch || 'main' }}
run: node scripts/publish-image.js
- name: Remove temporary build tag
if: always()
run: docker image rm "$JOB_IMAGE" || true