The push trigger's paths filter also applied to tag pushes, which change no files: the v0.4.0 tag started no run and ghcr.io/yundera/ipcr-forge:0.4.0 was never published (a fresh install failed pulling it).
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
name: image
|
|
|
|
# IPCR Forge's service image (forge/): Gitea → Radicle mirror, the forge's page and admin, the
|
|
# staging gate. ghcr.io/yundera/ipcr-forge; a `vX.Y.Z` tag publishes X.Y.Z.
|
|
# No `paths` filter on push: a tag push changes no files, so with one GitHub never starts the run
|
|
# and the release image is never built (v0.4.0's first push).
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
paths: ["forge/**", ".github/workflows/image.yml"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
IMAGE: ghcr.io/yundera/ipcr-forge
|
|
|
|
jobs:
|
|
vet:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: forge/go.mod
|
|
- run: test -z "$(gofmt -l .)" && go vet ./... && go test ./...
|
|
working-directory: forge
|
|
|
|
image:
|
|
needs: vet
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
- uses: docker/login-action@v3
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.IMAGE }}
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=ref,event=branch
|
|
type=sha
|
|
# amd64 only: the Radicle CLI is fetched as its x86_64 release, and the Forge listing is
|
|
# amd64 only.
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: forge
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: VERSION=${{ steps.meta.outputs.version }}
|
|
cache-from: type=gha,scope=forge
|
|
cache-to: type=gha,mode=max,scope=forge
|