-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 3.17 KB
/
image.yml
File metadata and controls
89 lines (78 loc) · 3.17 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
79
80
81
82
83
84
85
86
87
88
89
# Build and publish the production container image to GHCR.
#
# The image at packages/api/Dockerfile is the single deployable artefact:
# Express + bundled SPA + /v1/traces ingest, all served on one port. This
# workflow is the upstream side of any deployment — downstream operators
# can pull from GHCR and re-tag into their own private registry if their
# policy requires it.
#
# Triggers:
# - manual workflow_dispatch only (intentional — operator runs builds
# when they want them, not on every push). Once the build path has
# been exercised a few times and a release cadence is in place, a
# `push: branches: [main]` and/or `push: tags: ['v*']` block can be
# added back so :latest moves automatically.
name: Image
on:
workflow_dispatch:
concurrency:
group: image-${{ github.ref }}
cancel-in-progress: false # don't cancel in-flight pushes
permissions:
contents: read
packages: write # required for GHCR push via GITHUB_TOKEN
jobs:
build-and-push:
name: Build + push to GHCR
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image metadata
id: meta
uses: docker/metadata-action@v5
with:
# Image namespace = ghcr.io/<owner-lowercase>/<repo>.
# For vilosource/token-tracker that resolves to
# ghcr.io/vilosource/token-tracker.
images: ghcr.io/${{ github.repository }}
# Manual builds always tag :latest + :sha-<short>. When push
# triggers come back, the type=ref/type=tag entries will fire
# branch- and tag-based names too.
tags: |
type=sha,prefix=sha-,format=short
type=raw,value=latest
labels: |
org.opencontainers.image.title=token-tracker
org.opencontainers.image.description=Per-developer agent token-usage telemetry dashboard. Single Express+SPA binary serving /api/me, /v1/traces ingest, OIDC auth.
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.licenses=MIT
- name: Build + push
uses: docker/build-push-action@v6
with:
context: .
file: packages/api/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Buildx cache via GH Actions cache backend; speeds up rebuilds
# of the npm-install / SPA-build layers.
cache-from: type=gha
cache-to: type=gha,mode=max
# Provenance attestations on by default in build-push-action v6;
# OK to keep — GHCR understands them. Disable here only if a
# downstream registry chokes on them.
provenance: true
- name: Print pushed tags
run: |
echo "Pushed:"
echo "${{ steps.meta.outputs.tags }}"