-
Notifications
You must be signed in to change notification settings - Fork 1
170 lines (157 loc) · 5.81 KB
/
beta.yml
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
name: Beta CI
on:
schedule:
- cron: "*/20 * * * *"
env:
NAME: rust
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- alpine3.20
- alpine3.19
- bookworm
- bookworm-slim
- bullseye
- bullseye-slim
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check upstream version changed
id: upstream
run: |
result=$(bash beta/check-changed.sh 2>&1)
echo "$result"
echo 'result<<EOF'$'\n'"$result"$'\n'EOF >> $GITHUB_OUTPUT
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/${{ env.NAME }}
IMAGE_OS: ${{ matrix.os }}
- uses: docker/setup-buildx-action@v3
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
- name: Build image
run: docker build --network=host --force-rm --no-cache --pull
--label org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
-t ${{ github.repository_owner }}/${{ env.NAME }}:build-${{ matrix.os }}
./beta/${{ matrix.os }}/
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
- name: Tar image
run: docker save -o image.tar
${{ github.repository_owner }}/${{ env.NAME }}:build-${{ matrix.os }}
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
# TODO: Migrate to v4 once `xSAVIKx/artifact-exists-action` supports it:
# https://github.com/xSAVIKx/artifact-exists-action/tree/v0.6#artifact-exists-action
- uses: actions/upload-artifact@v3
with:
name: build-${{ matrix.os }}-${{ github.run_number }}
path: image.tar
retention-days: 1
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
push:
needs: ["build"]
strategy:
fail-fast: false
matrix:
registry: ["ghcr.io", "docker.io", "quay.io"]
os:
- alpine3.20
- alpine3.19
- bookworm
- bookworm-slim
- bullseye
- bullseye-slim
include:
- os: alpine3.20
tags: |
<full-ver>-alpine3.20
<full-ver>-alpine
<num-ver>-beta-alpine3.20
<num-ver>-beta-alpine
beta-alpine3.20
beta-alpine
- os: alpine3.19
tags: |
<full-ver>-alpine3.19
<num-ver>-beta-alpine3.19
beta-alpine3.19
- os: bookworm
tags: |
<full-ver>-bookworm
<full-ver>
<num-ver>-beta-bookworm
<num-ver>-beta
beta-bookworm
beta
- os: bookworm-slim
tags: |
<full-ver>-bookworm-slim
<full-ver>-slim
<num-ver>-beta-bookworm-slim
<num-ver>-beta-slim
beta-bookworm-slim
beta-slim
- os: bullseye
tags: |
<full-ver>-bullseye
<num-ver>-beta-bullseye
beta-bullseye
- os: bullseye-slim
tags: |
<full-ver>-bullseye-slim
<num-ver>-beta-bullseye-slim
beta-bullseye-slim
runs-on: ubuntu-latest
steps:
# Skip if this is fork and no credentials are provided.
- id: skip
run: echo "no=${{ !(
github.repository_owner != 'instrumentisto'
&& ((matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_USER == '')
|| (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_USER == ''))
) }}" >> $GITHUB_OUTPUT
- name: Check new image was built
id: artifact
uses: xSAVIKx/[email protected]
with:
name: build-${{ matrix.os }}-${{ github.run_number }}
- uses: actions/checkout@v4
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
# TODO: Migrate to v4 once `xSAVIKx/artifact-exists-action` supports it:
# https://github.com/xSAVIKx/artifact-exists-action/tree/v0.6#artifact-exists-action
- uses: actions/download-artifact@v3
with:
name: build-${{ matrix.os }}-${{ github.run_number }}
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
- name: Untar image
run: docker load -i image.tar
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
- name: Login to ${{ matrix.registry }} container registry
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry }}
username: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_USER)
|| (matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_USER)
|| github.repository_owner }}
password: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_PASS)
|| (matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_TOKEN)
|| secrets.GITHUB_TOKEN }}
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
- name: Push image
run: bash beta/push.sh
env:
IMAGE_FROM: ${{ github.repository_owner }}/${{ env.NAME }}:build-${{ matrix.os }}
IMAGE: ${{ matrix.registry }}/${{ github.repository_owner }}/${{ env.NAME }}
IMAGE_TAGS: ${{ matrix.tags }}
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}