-
Notifications
You must be signed in to change notification settings - Fork 169
executable file
·200 lines (175 loc) · 5.35 KB
/
Copy pathbuild-rpm.yml
File metadata and controls
executable file
·200 lines (175 loc) · 5.35 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
name: Run Build Tasks and Release
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-arm64:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: read
strategy:
matrix:
include:
- tag: aarch64_el8
- tag: aarch64_el9
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run pullsrc.sh
run: env ALL=1 ./pullsrc.sh
- name: Generate version-local.env
run: |
TAG=${{ github.ref_name }}
BUILD_NUM=$(echo "$TAG" | grep -oE 'b[0-9]+' | tail -1)
if [ -z "$BUILD_NUM" ]; then
BUILD_NUM="b1"
fi
echo "WITH_OPENSSL=2" > version-local.env
echo "PKGREL=$BUILD_NUM" >> version-local.env
cat version-local.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run ${{ matrix.tag }}
run: |
docker run --rm \
-v $(pwd):/data \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
- name: Upload RPM artifacts
uses: actions/upload-artifact@v4
with:
name: rpm-${{ matrix.tag }}
path: output/*.rpm
if-no-files-found: ignore
build-amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
strategy:
matrix:
include:
- tag: el9
- tag: el8
- tag: el7
- tag: el6
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run pullsrc.sh
run: env ALL=1 ./pullsrc.sh
- name: Generate version-local.env
run: |
TAG=${{ github.ref_name }}
BUILD_NUM=$(echo "$TAG" | grep -oE 'b[0-9]+' | tail -1)
if [ -z "$BUILD_NUM" ]; then
BUILD_NUM="b1"
fi
echo "WITH_OPENSSL=2" > version-local.env
echo "PKGREL=$BUILD_NUM" >> version-local.env
cat version-local.env
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run ${{ matrix.tag }}
run: |
docker run --rm \
-v $(pwd):/data \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
- name: Upload RPM artifacts
uses: actions/upload-artifact@v4
with:
name: rpm-${{ matrix.tag }}
path: output/*.rpm
if-no-files-found: ignore
build-el5:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
strategy:
matrix:
include:
- m32: "0"
arch: x86_64
- m32: "1"
arch: i686
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run pullsrc.sh
run: env ALL=1 ./pullsrc.sh
- name: Generate version-local.env
run: |
TAG=${{ github.ref_name }}
BUILD_NUM=$(echo "$TAG" | grep -oE 'b[0-9]+' | tail -1)
if [ -z "$BUILD_NUM" ]; then
BUILD_NUM="b1"
fi
echo "WITH_OPENSSL=2" > version-local.env
echo "PKGREL=$BUILD_NUM" >> version-local.env
cat version-local.env
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run el5 with M32=${{ matrix.m32 }}
run: |
docker run --rm \
-v $(pwd):/data \
-e "M32=${{ matrix.m32 }}" \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:el5
- name: Upload RPM artifacts
uses: actions/upload-artifact@v4
with:
name: rpm-el5-${{ matrix.arch }}
path: output/*.rpm
if-no-files-found: ignore
release:
needs: [build-arm64, build-amd64, build-el5]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List downloaded artifacts
run: |
echo "Downloaded artifact directories:"
find artifacts -mindepth 1 -maxdepth 1 -type d
- name: Repackage artifacts with prefixed names
run: |
TAG=${{ github.ref_name }}
mkdir -p release-assets
for dir in artifacts/*/; do
artifact_name=$(basename "$dir")
new_name="openssh_${TAG}_${artifact_name}"
echo "Packaging ${artifact_name} -> ${new_name}.zip"
(cd "$dir" && zip -r "${GITHUB_WORKSPACE}/release-assets/${new_name}.zip" .)
done
echo "Release assets:"
ls -la release-assets
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release-assets/*.zip
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}