-
Notifications
You must be signed in to change notification settings - Fork 20
210 lines (180 loc) · 7.46 KB
/
release.yaml
File metadata and controls
210 lines (180 loc) · 7.46 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
name: release-packages-and-images
# Workflow to build and release the following MicroShift artifacts:
# - RPM packages
# - DEB packages
# - Bootc container images
on:
workflow_dispatch:
inputs:
ushift-gitref:
default: "main"
description: MicroShift git ref (branch, tag, commit) from https://github.com/openshift/microshift/branches
type: string
okd-version-tag:
default: "latest"
description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags
type: string
build:
type: choice
description: Types of artifacts to build
default: all
options:
- all
- packages
- bootc-image
jobs:
build-microshift:
strategy:
matrix:
runners: [ubuntu-24.04, ubuntu-24.04-arm]
name: Build MicroShift upstream
runs-on: ${{ matrix.runners }}
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
- name: Detect the CPU architecture
id: detect-cpu-arch
uses: ./.github/actions/arch
- name: Detect OKD version tag
id: detect-okd-version
uses: ./.github/actions/okd-version
- name: Determine bootc stream version
id: set-bootc-image-tag
shell: bash
run: |
set -euo pipefail
set -x
ref="${{ inputs.ushift-gitref }}"
tag="stream10"
# Prior to version 4.21, crio depends on containernetworking-plugins
# which is not available in CentOS Stream 10
if [[ "${ref}" =~ release-4\.([0-9]+) ]]; then
yver="${BASH_REMATCH[1]}"
if [ "${yver}" -lt 21 ]; then
tag="stream9"
fi
fi
echo "bootc-image-tag=${tag}" >> "${GITHUB_OUTPUT}"
- name: Run the build action
uses: ./.github/actions/build
with:
ushift-gitref: ${{ inputs.ushift-gitref }}
okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }}
bootc-image-url: quay.io/centos-bootc/centos-bootc
bootc-image-tag: ${{ steps.set-bootc-image-tag.outputs.bootc-image-tag }}
build: ${{ inputs.build }}
# Test the local container image with the quick start and clean procedures
# before releasing the artifacts. Make sure not to run the clean scripts
# because the images are needed for the release process.
- name: Run the quick start script and clean scripts
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: ./.github/actions/quick-start-clean
with:
image-ref: localhost/microshift-okd:latest
run-clean: false
# Prepare the RPM archives to be released before converting to DEB packages.
- name: Prepare the RPM archives
if: contains(fromJSON('["all", "packages"]'), inputs.build)
shell: bash
run : |
# Archive sources separately from the RPMs
sudo mv /mnt/rpms/srpms /mnt/srpms
cd /mnt/srpms
sudo tar zcvf /mnt/release/microshift-src.tgz .
cd /mnt/rpms
sudo tar zcvf /mnt/release/microshift-rpms-$(uname -m).tgz .
- name: Store version in a variable
id: version
run: |
set -euo pipefail
if [ ! -f /mnt/rpms/version.txt ]; then
echo "ERROR: version.txt not found at /mnt/rpms/version.txt"
exit 1
fi
echo "version=$(cat /mnt/rpms/version.txt)" >> "${GITHUB_OUTPUT}"
- name: Push version.txt to artifacts
uses: actions/upload-artifact@v4
with:
name: version.txt
path: /mnt/rpms/version.txt
overwrite: true
# This step is run after the RPM archives are prepared to avoid
# including DEB packages in the RPM archive.
- name: Convert the RPMs to DEB packages
if: contains(fromJSON('["all", "packages"]'), inputs.build)
uses: ./.github/actions/build-deb
with:
ushift-gitref: ${{ inputs.ushift-gitref }}
okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }}
build-rpms: false
- name: Prepare the DEB archives
if: contains(fromJSON('["all", "packages"]'), inputs.build)
shell: bash
run: |
cd /mnt/rpms/deb
sudo tar zcvf /mnt/release/microshift-debs-$(uname -m).tgz .
- name: Release RPM and DEB packages
if: contains(fromJSON('["all", "packages"]'), inputs.build)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
files: |
/mnt/release/microshift-rpms-*.tgz
/mnt/release/microshift-debs-*.tgz
/mnt/release/microshift-src.tgz
overwrite_files: true
- name: Login to GitHub Container Registry
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: ./.github/actions/podman-login
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Bootc container image for the target architecture
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
shell: bash
run: |
set -euo pipefail
set -x
TARGET_IMAGE="ghcr.io/${{ github.repository_owner }}/microshift"
TARGET_TAG="${{ steps.version.outputs.version }}-${{ steps.detect-cpu-arch.outputs.go_arch }}"
sudo podman tag microshift-okd "${TARGET_IMAGE}:${TARGET_TAG}"
sudo podman push "${TARGET_IMAGE}:${TARGET_TAG}"
release-microshift:
needs: build-microshift
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: version.txt
path: /tmp/
- name: Store version in a variable
id: version
run: |
echo "version=$(cat /tmp/version.txt)" >> "${GITHUB_OUTPUT}"
- name: Login to GitHub Container Registry
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: ./.github/actions/podman-login
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Bootc container image manifest
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
shell: bash
run: |
set -euo pipefail
set -x
TARGET_IMAGE="ghcr.io/${{ github.repository_owner }}/microshift"
TARGET_TAG="${{ steps.version.outputs.version }}"
sudo podman manifest create "${TARGET_IMAGE}:${TARGET_TAG}"
sudo podman manifest add "${TARGET_IMAGE}:${TARGET_TAG}" "${TARGET_IMAGE}:${TARGET_TAG}-amd64"
sudo podman manifest add "${TARGET_IMAGE}:${TARGET_TAG}" "${TARGET_IMAGE}:${TARGET_TAG}-arm64"
sudo podman manifest push "${TARGET_IMAGE}:${TARGET_TAG}"
# Prepare the release note for the bootc image usage
OWNER="${{ github.repository_owner }}" IMAGE="${TARGET_IMAGE}" TAG="${TARGET_TAG}" \
envsubst < .github/workflows/release.md > /tmp/release.md
- name: Add release note for bootc image usage
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
body_path: /tmp/release.md