-
Notifications
You must be signed in to change notification settings - Fork 2.9k
219 lines (181 loc) · 7.38 KB
/
release.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
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
219
on:
release:
types: [published]
env:
GO_VERSION: "1.20"
LINUX_ARCHES: "amd64 arm arm64 s390x ppc64le mips64le riscv64"
REPOSITORY: flannel/flannel
jobs:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: go mod vendor
run: go mod vendor
- name: build linux
run: |
set -e
for arch in ${LINUX_ARCHES}; do
echo "Building for arch $arch"
ARCH=$arch make dist/flanneld-$arch
file dist/flanneld-$arch
done
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REPOSITORY }}
flavor: latest=false
tags: |
type=ref,event=tag
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image for amd64
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.amd64 -t ${{ steps.meta.outputs.tags }}-amd64 .
docker push ${{ steps.meta.outputs.tags }}-amd64
- name: Build and push Docker image for arm
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.arm -t ${{ steps.meta.outputs.tags }}-arm .
docker push ${{ steps.meta.outputs.tags }}-arm
- name: Build and push Docker image for arm64
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.arm64 -t ${{ steps.meta.outputs.tags }}-arm64 .
docker push ${{ steps.meta.outputs.tags }}-arm64
- name: Build and push Docker image for s390x
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.s390x -t ${{ steps.meta.outputs.tags }}-s390x .
docker push ${{ steps.meta.outputs.tags }}-s390x
- name: Build and push Docker image for ppc64le
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.ppc64le -t ${{ steps.meta.outputs.tags }}-ppc64le .
docker push ${{ steps.meta.outputs.tags }}-ppc64le
- name: Build and push Docker image for mips64le
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.mips64le -t ${{ steps.meta.outputs.tags }}-mips64le .
docker push ${{ steps.meta.outputs.tags }}-mips64le
- name: Build and push Docker image for riscv64
if: github.repository_owner == 'flannel-io'
run: |
docker build -f images/Dockerfile.riscv64 -t ${{ steps.meta.outputs.tags }}-riscv64 .
docker push ${{ steps.meta.outputs.tags }}-riscv64
build-and-push-multi-arch-image:
needs: [build-and-push-images]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: go mod vendor
run: go mod vendor
- name: build linux
run: |
set -e
for arch in ${LINUX_ARCHES}; do
echo "Building for arch $arch"
ARCH=$arch make dist/flanneld-$arch
file dist/flanneld-$arch
done
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REPOSITORY }}
flavor: latest=false
tags: |
type=ref,event=tag
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create and push manifest for multi-arch image
if: github.repository_owner == 'flannel-io'
run: |
# get artifacts from previous steps and integrate into one multi-arch manifest
docker pull ${{ steps.meta.outputs.tags }}-amd64
docker pull ${{ steps.meta.outputs.tags }}-arm64
docker pull ${{ steps.meta.outputs.tags }}-arm
docker pull ${{ steps.meta.outputs.tags }}-ppc64le
docker pull ${{ steps.meta.outputs.tags }}-s390x
docker pull ${{ steps.meta.outputs.tags }}-mips64le
docker pull ${{ steps.meta.outputs.tags }}-riscv64
docker manifest create ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-amd64 ${{ steps.meta.outputs.tags }}-arm64 ${{ steps.meta.outputs.tags }}-arm ${{ steps.meta.outputs.tags }}-ppc64le ${{ steps.meta.outputs.tags }}-s390x ${{ steps.meta.outputs.tags }}-mips64le
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-amd64 --arch amd64
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-arm64 --arch arm64
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-arm --arch arm
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-ppc64le --arch ppc64le
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-s390x --arch s390x
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-mips64le --arch mips64le
docker manifest annotate ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}-riscv64 --arch riscv64
docker manifest push ${{ steps.meta.outputs.tags }}
docker pull ${{ steps.meta.outputs.tags }}
docker tag ${{ steps.meta.outputs.tags }} ${{ env.REPOSITORY }}:latest
docker push ${{ env.REPOSITORY }}:latest
build-and-push-artifacts:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: go mod vendor
run: go mod vendor
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build release artifacts
run: make release
- name: Upload release files
uses: softprops/action-gh-release@v1
with:
files: |
dist/flannel*
dist/kube-flannel.yml
dist/kube-flannel-psp.yml
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'chart/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2