printhive/.forgejo/workflows/build.yml
dlawler489 baa5ba4382 Build the CI checks instead of bind-mounting them
The job runs inside a container, so -v "$PWD" mounted a path the Docker
daemon doesn't have and npm ci found no lockfile. Dockerfile.check sends
the repo as a build context instead. The gate itself worked: the image
build was skipped rather than pushing something unchecked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 11:44:13 +10:00

35 lines
1.1 KiB
YAML

name: build-and-push
on:
push:
branches: [main]
tags: ['v*']
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint and test
# Built, not mounted: this job runs in a container, so a host bind mount
# of $PWD arrives empty. A failure here stops the image being built.
run: docker build -f Dockerfile.check -t printhive-check .
- name: Log in to the Forgejo container registry
# REGISTRY_TOKEN = a Forgejo access token with write:package scope, added
# as a repo Actions secret. The auto GITHUB_TOKEN can't push packages.
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.plexultra.com -u "${{ github.repository_owner }}" --password-stdin
- name: Build and push image
run: |
IMAGE="git.plexultra.com/${{ github.repository }}"
SHA="${{ github.sha }}"
docker build -t "$IMAGE:latest" -t "$IMAGE:${SHA:0:12}" .
docker push "$IMAGE:latest"
docker push "$IMAGE:${SHA:0:12}"