-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (73 loc) · 2.96 KB
/
containers.yml
File metadata and controls
82 lines (73 loc) · 2.96 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
name: Containers
on:
push:
branches: [main]
paths:
- .github/workflows/containers.yml
- containers/**
pull_request:
branches: [main]
paths:
- .github/workflows/containers.yml
- containers/**
jobs:
nix-runner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 # v31.10.6
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
extra-experimental-features = nix-command flakes pipe-operators
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build runner image
run: |
nix build '.#runner'
actions-runner:
runs-on: ubuntu-latest
env:
# renovate: datasource=docker depName=ghcr.io/actions/actions-runner
ACTIONS_RUNNER_VERSION: 2.334.0
steps:
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
- id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
with:
images: |
ghcr.io/${{ github.repository }}/actions-runner
flavor: |
latest=auto
# defensive tagging because I'm an idiot
tags: |
type=ref,event=branch,suffix=-${{ env.ACTIONS_RUNNER_VERSION }}
type=ref,event=branch,suffix=-v${{ env.ACTIONS_RUNNER_VERSION }}
type=ref,event=branch,suffix=-${{ env.ACTIONS_RUNNER_VERSION }}-${{ github.run_number }}
type=ref,event=branch,suffix=-v${{ env.ACTIONS_RUNNER_VERSION }}-${{ github.run_number }}
type=raw,value=${{ env.ACTIONS_RUNNER_VERSION }}
type=raw,value=v${{ env.ACTIONS_RUNNER_VERSION }}
type=sha
- uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
file: containers/runner/Dockerfile
build-args: |
ACTIONS_RUNNER_VERSION=${{ env.ACTIONS_RUNNER_VERSION }}
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/arm64,linux/amd64' }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: ${{ github.event_name != 'pull_request' }}
sbom: ${{ github.event_name != 'pull_request' }}