Skip to content

Commit 97ee90b

Browse files
committed
split job
1 parent 4f18b71 commit 97ee90b

1 file changed

Lines changed: 105 additions & 55 deletions

File tree

.github/workflows/release.yml

Lines changed: 105 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -82,38 +82,31 @@ jobs:
8282
- self-hosted
8383
- Linux
8484
- X64
85-
container:
86-
image: debian:12
87-
env:
88-
DEBIAN_FRONTEND: noninteractive
89-
HOME: /root
90-
RUSTUP_HOME: /root/.rustup
91-
CARGO_HOME: /root/.cargo
9285
env:
9386
SCCACHE_GHA_ENABLED: "false"
9487
RUSTC_WRAPPER: ""
9588

9689
steps:
9790
- name: Install dependencies
9891
run: |
99-
dpkg --add-architecture arm64
100-
apt-get update
101-
apt-get install -y \
92+
sudo dpkg --add-architecture arm64
93+
sudo apt-get update
94+
sudo apt-get install -y \
10295
git curl ca-certificates \
10396
build-essential pkg-config \
10497
libssl-dev libssl-dev:arm64 \
10598
gcc-aarch64-linux-gnu \
10699
protobuf-compiler libprotobuf-dev \
107100
rsync openssh-client \
108101
ruby ruby-dev rubygems rpm
109-
gem install fpm --no-document
102+
sudo gem install fpm --no-document
110103
git config --global --add safe.directory '*'
111104
112105
# Store the version, stripping any v-prefix
113106
- name: Write release version
114107
run: |
115108
# VERSION=${GITHUB_REF_NAME#v}
116-
VERSION="v2.0.1-test"
109+
VERSION="2.0.1-test"
117110
echo Version: $VERSION
118111
echo "VERSION=$VERSION" >> $GITHUB_ENV
119112
@@ -155,7 +148,8 @@ jobs:
155148
- name: Build Linux aarch64 binary
156149
env:
157150
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
158-
PKG_CONFIG_SYSROOT_DIR: /usr/lib/aarch64-linux-gnu
151+
PKG_CONFIG_ALLOW_CROSS: "1"
152+
PKG_CONFIG_LIBDIR: /usr/lib/aarch64-linux-gnu/pkgconfig
159153
run: |
160154
cargo build --locked --release --target aarch64-unknown-linux-gnu
161155
mv target/aarch64-unknown-linux-gnu/release/defguard defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu
@@ -170,36 +164,6 @@ jobs:
170164
tar -zcf defguard-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \
171165
defguard-${{ env.VERSION }}-x86_64-unknown-freebsd
172166
173-
- name: Build x86_64 DEB package
174-
run: |
175-
fpm \
176-
--output-type deb \
177-
--version "${{ env.VERSION }}" \
178-
--architecture amd64 \
179-
--package defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb \
180-
--before-install linux/preinst \
181-
--after-install linux/postinst \
182-
--before-remove linux/prerm \
183-
--after-remove linux/postrm \
184-
"defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard" \
185-
"linux/defguard.service=/usr/lib/systemd/system/defguard.service" \
186-
".env.example=/etc/defguard/core.conf"
187-
188-
- name: Build aarch64 DEB package
189-
run: |
190-
fpm \
191-
--output-type deb \
192-
--version "${{ env.VERSION }}" \
193-
--architecture arm64 \
194-
--package defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb \
195-
--before-install linux/preinst \
196-
--after-install linux/postinst \
197-
--before-remove linux/prerm \
198-
--after-remove linux/postrm \
199-
"defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard" \
200-
"linux/defguard.service=/usr/lib/systemd/system/defguard.service" \
201-
".env.example=/etc/defguard/core.conf"
202-
203167
- name: Build x86_64 RPM package
204168
run: |
205169
fpm \
@@ -243,6 +207,22 @@ jobs:
243207
"freebsd/defguard=/usr/local/etc/rc.d/defguard" \
244208
".env.example=/etc/defguard/core.conf"
245209
210+
- name: Upload binaries for deb job
211+
uses: actions/upload-artifact@v4
212+
with:
213+
name: binaries-for-deb
214+
path: |
215+
defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu
216+
defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu
217+
linux/preinst
218+
linux/postinst
219+
linux/prerm
220+
linux/postrm
221+
linux/defguard.service
222+
.env.example
223+
include-hidden-files: true
224+
retention-days: 1
225+
246226
- name: Upload Linux x86_64 archive
247227
uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1
248228
env:
@@ -273,52 +253,122 @@ jobs:
273253
asset_content_type: application/gzip
274254
overwrite: true
275255

276-
- name: Upload Linux x86_64 DEB
256+
- name: Upload Linux x86_64 RPM
277257
uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1
278258
env:
279259
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280260
with:
281261
upload_url: ${{ needs.create-release.outputs.upload_url }}
282-
asset_path: defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
262+
asset_path: defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu.rpm
283263
asset_content_type: application/gzip
284264
overwrite: true
285265

286-
- name: Upload Linux aarch64 DEB
266+
- name: Upload Linux aarch64 RPM
287267
uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1
288268
env:
289269
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
290270
with:
291271
upload_url: ${{ needs.create-release.outputs.upload_url }}
292-
asset_path: defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb
272+
asset_path: defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm
293273
asset_content_type: application/gzip
294274
overwrite: true
295275

296-
- name: Upload Linux x86_64 RPM
276+
- name: Upload FreeBSD package
297277
uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1
298278
env:
299279
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
300280
with:
301281
upload_url: ${{ needs.create-release.outputs.upload_url }}
302-
asset_path: defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu.rpm
303-
asset_content_type: application/gzip
282+
asset_path: defguard-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
283+
asset_content_type: application/x-pkg
304284
overwrite: true
305285

306-
- name: Upload Linux aarch64 RPM
286+
build-deb-packages:
287+
needs:
288+
- create-release
289+
- build-binaries
290+
runs-on:
291+
- self-hosted
292+
- Linux
293+
- X64
294+
container:
295+
image: debian:12
296+
env:
297+
DEBIAN_FRONTEND: noninteractive
298+
299+
steps:
300+
- name: Install dependencies
301+
run: |
302+
apt-get update
303+
apt-get install -y \
304+
ca-certificates \
305+
ruby ruby-dev rubygems \
306+
build-essential
307+
gem install fpm --no-document
308+
309+
- name: Write release version
310+
run: |
311+
# VERSION=${GITHUB_REF_NAME#v}
312+
VERSION="2.0.1-test"
313+
echo Version: $VERSION
314+
echo "VERSION=$VERSION" >> $GITHUB_ENV
315+
316+
- name: Download binaries from build job
317+
uses: actions/download-artifact@v4
318+
with:
319+
name: binaries-for-deb
320+
321+
- name: Restore executable permissions
322+
run: |
323+
chmod +x defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu
324+
chmod +x defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu
325+
326+
- name: Build x86_64 DEB package
327+
run: |
328+
fpm \
329+
--output-type deb \
330+
--version "${{ env.VERSION }}" \
331+
--architecture amd64 \
332+
--package defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb \
333+
--before-install linux/preinst \
334+
--after-install linux/postinst \
335+
--before-remove linux/prerm \
336+
--after-remove linux/postrm \
337+
"defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard" \
338+
"linux/defguard.service=/usr/lib/systemd/system/defguard.service" \
339+
".env.example=/etc/defguard/core.conf"
340+
341+
- name: Build aarch64 DEB package
342+
run: |
343+
fpm \
344+
--output-type deb \
345+
--version "${{ env.VERSION }}" \
346+
--architecture arm64 \
347+
--package defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb \
348+
--before-install linux/preinst \
349+
--after-install linux/postinst \
350+
--before-remove linux/prerm \
351+
--after-remove linux/postrm \
352+
"defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard" \
353+
"linux/defguard.service=/usr/lib/systemd/system/defguard.service" \
354+
".env.example=/etc/defguard/core.conf"
355+
356+
- name: Upload Linux x86_64 DEB
307357
uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1
308358
env:
309359
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
310360
with:
311361
upload_url: ${{ needs.create-release.outputs.upload_url }}
312-
asset_path: defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm
362+
asset_path: defguard-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
313363
asset_content_type: application/gzip
314364
overwrite: true
315365

316-
- name: Upload FreeBSD package
366+
- name: Upload Linux aarch64 DEB
317367
uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1
318368
env:
319369
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
320370
with:
321371
upload_url: ${{ needs.create-release.outputs.upload_url }}
322-
asset_path: defguard-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
323-
asset_content_type: application/x-pkg
372+
asset_path: defguard-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb
373+
asset_content_type: application/gzip
324374
overwrite: true

0 commit comments

Comments
 (0)