-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (69 loc) · 2.16 KB
/
Copy pathrunner.yml
File metadata and controls
79 lines (69 loc) · 2.16 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
name: Build & Publish External Runner Image
on:
push:
branches: [master]
paths:
- 'runner/**'
- 'forge/**'
- '.github/workflows/runner.yml'
workflow_dispatch:
inputs:
tag:
description: 'Image tag (e.g. v1.0.0)'
required: false
default: ''
permissions:
contents: read
packages: write
id-token: write # required for Sigstore keyless signing
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install cosign
uses: sigstore/cosign-installer@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Derive tags
id: tags
run: |
SHA="${GITHUB_SHA::12}"
INPUT_TAG="${{ github.event.inputs.tag }}"
IMAGE="ghcr.io/forge-nc/forge-external-runner"
TAGS="${IMAGE}:${SHA}"
if [ "${GITHUB_REF}" = "refs/heads/master" ]; then
TAGS="${TAGS},${IMAGE}:latest,${IMAGE}:v1"
fi
if [ -n "$INPUT_TAG" ]; then
TAGS="${TAGS},${IMAGE}:${INPUT_TAG}"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
- name: Build and push
id: push
uses: docker/build-push-action@v6
with:
context: .
file: runner/Dockerfile.runner
push: true
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign image with Sigstore (keyless, OIDC)
env:
COSIGN_EXPERIMENTAL: 1
DIGEST: ${{ steps.push.outputs.digest }}
IMAGE: ${{ steps.tags.outputs.image }}
run: |
cosign sign --yes "${IMAGE}@${DIGEST}"
- name: Emit digest for .well-known update
run: |
echo "Image digest: ${{ steps.push.outputs.digest }}"
echo "Update /.well-known/forge-origin.json runner_image_digest field to this value."