-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (144 loc) · 6.62 KB
/
build.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
name: Build Containerd
on:
workflow_dispatch:
schedule:
- cron: '0 20 * * *'
jobs:
check-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Get Version
run: |
CONTAINERD_VERSION=v$(curl -sSL https://github.com/docker/containerd-packaging/raw/main/debian/changelog | head -n 1 | grep -oP '\(\K[^\)]+' | cut -d'-' -f1)
sed -i "s@CONTAINERD_VERSION=.*@CONTAINERD_VERSION=${CONTAINERD_VERSION}@g" build-containerd.sh
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
echo ""
echo "========== Build Args =========="
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
- name: Check Release
id: check-release
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Tag
if : steps.check-release.outputs.create == '1'
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "Release ${{ env.CONTAINERD_VERSION }}" || true
git tag ${{ env.CONTAINERD_VERSION }}
git push origin ${{ env.CONTAINERD_VERSION }} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if : steps.check-release.outputs.create == '1'
run: |
gh release create ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} --title ${{ env.CONTAINERD_VERSION }} --notes "**Full Changelog**: [${{ env.CONTAINERD_VERSION }}](https://github.com/containerd/containerd/releases/tag/${{ env.CONTAINERD_VERSION }})"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check-binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Get Version
run: |
CONTAINERD_VERSION=$(curl -s "https://api.github.com/repos/containerd/containerd/releases/latest" | jq -r .tag_name)
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
sed -i "s@ARG CONTAINERD_VERSION=.*@ARG CONTAINERD_VERSION=${CONTAINERD_VERSION}@g" binaries/Dockerfile
echo ""
echo "========== Build Args =========="
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
- name: Check Release
id: check-release
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Tag
if : steps.check-release.outputs.create == '1'
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "Release ${{ env.CONTAINERD_VERSION }}" || true
git tag ${{ env.CONTAINERD_VERSION }}
git push origin ${{ env.CONTAINERD_VERSION }} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
if : steps.check-release.outputs.create == '1'
run: |
gh release create ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} --title ${{ env.CONTAINERD_VERSION }} --notes "**Full Changelog**: [${{ env.CONTAINERD_VERSION }}](https://github.com/containerd/containerd/releases/tag/${{ env.CONTAINERD_VERSION }})"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-binaries:
runs-on: ubuntu-latest
needs: check-binaries
steps:
- name: Get Version
run: |
CONTAINERD_VERSION=$(curl -s "https://api.github.com/repos/containerd/containerd/releases/latest" | jq -r .tag_name)
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.CONTAINERD_VERSION }}
- uses: docker/setup-buildx-action@v3
- name: Check Release
id: create-binaries
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} | grep containerd-.*.tar.gz >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup QEMU
if : steps.create-binaries.outputs.create == '1'
run: docker run --rm --privileged ghcr.io/loong64/qemu-user-static --reset -p yes
- name: Build Containerd Binaries
if : steps.create-binaries.outputs.create == '1'
run: |
cd binaries
docker buildx build --platform linux/loong64 -t containerd-static-loong64:${{ env.CONTAINERD_VERSION }} . --load
- name: Upgrade Release
if : steps.create-binaries.outputs.create == '1'
run: |
docker run --rm -v $(pwd)/dist:/dist containerd-static-loong64:${{ env.CONTAINERD_VERSION }}
ls -al dist
gh release upload ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-package:
runs-on: ubuntu-latest
needs: check-package
steps:
- name: Get Version
run: |
CONTAINERD_VERSION=v$(curl -sSL https://github.com/docker/containerd-packaging/raw/main/debian/changelog | head -n 1 | grep -oP '\(\K[^\)]+' | cut -d'-' -f1)
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.CONTAINERD_VERSION }}
- uses: docker/setup-buildx-action@v3
- name: Check Release
id: create-package
run: |
gh release view ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} | grep containerd.*.deb >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup QEMU
if : steps.create-package.outputs.create == '1'
run: docker run --rm --privileged ghcr.io/loong64/qemu-user-static --reset -p yes
- name: Build Containerd Package
if : steps.create-package.outputs.create == '1'
run: |
bash build-containerd.sh
- name: Upgrade Release
if : steps.create-package.outputs.create == '1'
run: |
ls -al dist
gh release upload ${{ env.CONTAINERD_VERSION }} -R ${{ github.repository }} dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}