-
Notifications
You must be signed in to change notification settings - Fork 24
155 lines (132 loc) · 4.97 KB
/
tag.yml
File metadata and controls
155 lines (132 loc) · 4.97 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Earthly tag +build
permissions: {}
on:
push:
tags:
- "v*.*.*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 1
jobs:
arm64-prebuild:
timeout-minutes: 60
runs-on: ubuntu-24.04-arm
permissions:
packages: write # write pacakges to ghcr
steps:
- uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
use-cache: false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
if: github.token != null
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Run build
id: build
run: |
earthly --ci --push -P +prebuild
amd64-prebuild:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
packages: write # write pacakges to ghcr
steps:
- uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
use-cache: false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
if: github.token != null
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Run build
id: build
run: |
earthly --ci --push -P +prebuild
build-images:
permissions:
packages: write # write pacakges to ghcr
timeout-minutes: 60
runs-on: ubuntu-latest
outputs:
digests: ${{ steps.image_manifest_metadata.outputs.digests }}
needs:
- arm64-prebuild
- amd64-prebuild
steps:
- name: Maximize build space
uses: ublue-os/remove-unwanted-software@cc0becac701cf642c8f0a6613bbdaf5dc36b259e # v9
# Setup repo and add caching
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
- uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 # v1.0.13
with:
use-cache: false
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Login to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run build
env:
GH_ACTOR: ${{ github.actor }}
GH_TOKEN: ${{ github.token }}
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
CARGO_PACKAGE_VERSION="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "blue-build") .version')"
LATEST=$(test "$CARGO_PACKAGE_VERSION" = "$LATEST_TAG" && echo true || echo false)
earthly --secret COSIGN_PRIVATE_KEY \
--secret GH_ACTOR --secret GH_TOKEN \
--push --ci -P +build-images-all \
--TAGGED="true" --LATEST="$LATEST"
earthly \
--artifact +sign-all/digest-list ./digest-list \
--TAGGED="true" --LATEST="$LATEST"
- name: Install regctl
uses: regclient/actions/regctl-installer@da9319db8e44e8b062b3a147e1dfb2f574d41a03 # main # zizmor: ignore[stale-action-refs] regctl does not publish tags
- name: Store image digest info
id: image_manifest_metadata
run: |
digest_list_json=$(jq -Rc '[ inputs | split(",") | {"image_ref":.[0],"image_digest":.[1]} ]' ./digest-list)
echo "digests=$digest_list_json" >> $GITHUB_OUTPUT
provenance:
needs: [build-images]
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
strategy:
matrix:
include: ${{ fromJson(needs.build-images.outputs.digests) }}
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: ${{ matrix.image_ref }}
digest: ${{ matrix.image_digest }}
registry-username: ${{ github.actor }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}