-
Notifications
You must be signed in to change notification settings - Fork 1
218 lines (182 loc) · 6.69 KB
/
release.yaml
File metadata and controls
218 lines (182 loc) · 6.69 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# SPDX-FileCopyrightText: Copyright 2025 Stacklok, Inc.
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
jobs:
build-artifacts:
name: Build (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build runner and extract libraries
run: task build-runner VERSION=${{ github.ref_name }}
- name: Package runtime tarball
run: task package-runtime TAG=${{ github.ref_name }}
- name: Package firmware tarball
run: task package-firmware TAG=${{ github.ref_name }}
- name: Upload runtime artifact
uses: actions/upload-artifact@v7
with:
name: go-microvm-runtime-linux-${{ matrix.arch }}
path: dist/go-microvm-runtime-linux-${{ matrix.arch }}.tar.gz
- name: Upload firmware artifact
uses: actions/upload-artifact@v7
with:
name: go-microvm-firmware-linux-${{ matrix.arch }}
path: dist/go-microvm-firmware-linux-${{ matrix.arch }}.tar.gz
build-artifacts-darwin:
name: Build macOS (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: arm64
runner: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Set up Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install libkrun via Homebrew
run: |
brew tap slp/krun
brew install libkrun libkrunfw
- name: Build runner and copy libraries
run: task build-runner-darwin VERSION=${{ github.ref_name }}
- name: Package runtime tarball
run: task package-runtime-darwin TAG=${{ github.ref_name }}
- name: Package firmware tarball
run: task package-firmware-darwin TAG=${{ github.ref_name }}
- name: Upload runtime artifact
uses: actions/upload-artifact@v7
with:
name: go-microvm-runtime-darwin-${{ matrix.arch }}
path: dist/go-microvm-runtime-darwin-${{ matrix.arch }}.tar.gz
- name: Upload firmware artifact
uses: actions/upload-artifact@v7
with:
name: go-microvm-firmware-darwin-${{ matrix.arch }}
path: dist/go-microvm-firmware-darwin-${{ matrix.arch }}.tar.gz
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: [build-artifacts, build-artifacts-darwin]
if: ${{ always() && needs.build-artifacts.result == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
merge-multiple: true
- name: Generate checksums
run: |
sha256sum go-microvm-*.tar.gz > sha256sums.txt
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "${{ github.ref_name }}" >/dev/null 2>&1; then
gh release upload "${{ github.ref_name }}" --clobber \
go-microvm-*.tar.gz sha256sums.txt
else
gh release create "${{ github.ref_name }}" --generate-notes \
go-microvm-*.tar.gz sha256sums.txt
fi
push-oci:
name: Push OCI (${{ matrix.arch }})
runs-on: ubuntu-latest
needs: build-artifacts
strategy:
matrix:
include:
- arch: amd64
- arch: arm64
steps:
- name: Download runtime artifact
uses: actions/download-artifact@v8
with:
name: go-microvm-runtime-linux-${{ matrix.arch }}
- name: Download firmware artifact
uses: actions/download-artifact@v8
with:
name: go-microvm-firmware-linux-${{ matrix.arch }}
- name: Install oras
uses: oras-project/setup-oras@v2
- name: Login to ghcr.io
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push runtime OCI artifact
run: |
oras push ghcr.io/stacklok/go-microvm/runtime:${{ github.ref_name }}-linux-${{ matrix.arch }} \
--artifact-type application/vnd.stacklok.go-microvm.runtime \
go-microvm-runtime-linux-${{ matrix.arch }}.tar.gz:application/gzip
- name: Push firmware OCI artifact
run: |
oras push ghcr.io/stacklok/go-microvm/firmware:${{ github.ref_name }}-linux-${{ matrix.arch }} \
--artifact-type application/vnd.stacklok.go-microvm.firmware \
go-microvm-firmware-linux-${{ matrix.arch }}.tar.gz:application/gzip
push-oci-darwin:
name: Push OCI macOS (${{ matrix.arch }})
runs-on: ubuntu-latest
needs: build-artifacts-darwin
strategy:
matrix:
include:
- arch: arm64
steps:
- name: Download runtime artifact
uses: actions/download-artifact@v8
with:
name: go-microvm-runtime-darwin-${{ matrix.arch }}
- name: Download firmware artifact
uses: actions/download-artifact@v8
with:
name: go-microvm-firmware-darwin-${{ matrix.arch }}
- name: Install oras
uses: oras-project/setup-oras@v2
- name: Login to ghcr.io
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push runtime OCI artifact
run: |
oras push ghcr.io/stacklok/go-microvm/runtime:${{ github.ref_name }}-darwin-${{ matrix.arch }} \
--artifact-type application/vnd.stacklok.go-microvm.runtime \
go-microvm-runtime-darwin-${{ matrix.arch }}.tar.gz:application/gzip
- name: Push firmware OCI artifact
run: |
oras push ghcr.io/stacklok/go-microvm/firmware:${{ github.ref_name }}-darwin-${{ matrix.arch }} \
--artifact-type application/vnd.stacklok.go-microvm.firmware \
go-microvm-firmware-darwin-${{ matrix.arch }}.tar.gz:application/gzip