-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (67 loc) · 2.79 KB
/
Copy pathimage.yml
File metadata and controls
78 lines (67 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Build and publish the pi-dispatch job image to GHCR so operators `docker pull` instead of the slow local
# build (Chromium + Playwright + fonts, minutes). main is branch-protected (a PR is required and the five
# contract checks in pi-upgrade-check.yml must be green, admins included), so a push here is an already-gated
# merge — nothing in this workflow merges anything (CONST-MERGE-NEVER-AUTOMATIC).
#
# The pushed image is a snapshot of THIS repo's runner + guardrails at the built commit. Operators who bake
# their own toolchain into image/Dockerfile still build locally; the pull is only the fast default path.
#
# No secret required: GHCR auth uses the built-in GITHUB_TOKEN (packages: write). One-time after the first
# successful run: make the ghcr.io/edgehero/pi-job package Public in the org's package settings, otherwise
# `docker pull` needs auth.
#
# Tags: `latest`, the git `sha`, and the PRODUCT version from the root package.json (so a release cuts a
# tag that never moves, and a deployment can pin `ghcr.io/edgehero/pi-job:<version>` instead of tracking latest).
name: image
on:
push:
branches: [main]
paths:
- "image/**"
- "package.json" # the ROOT one: a product version bump republishes under its own tag
- ".github/workflows/image.yml"
# Manual re-run (available once this file is on the default branch).
workflow_dispatch: {}
permissions:
contents: read
packages: write # push to ghcr.io/edgehero/*
concurrency:
group: image
cancel-in-progress: false
env:
IMAGE: ghcr.io/edgehero/pi-job
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3 # arm64 emulation for the multi-arch build
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve the product version (the tag operators can pin)
id: v
run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
- name: Tags + labels
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
type=raw,value=latest
type=raw,value=${{ steps.v.outputs.version }}
type=sha
- name: Build + push (amd64 + arm64)
uses: docker/build-push-action@v6
with:
context: . # repo root — the Dockerfile copies image/runner + guardrails from here
file: image/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max