-
-
Notifications
You must be signed in to change notification settings - Fork 13
79 lines (69 loc) · 2.94 KB
/
binaries.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
on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
env:
BINS: "add-backhand unsquashfs-backhand replace-backhand"
name: binaries
jobs:
# release binaries
release-bins:
runs-on: ${{ matrix.job.os }}
env:
RUSTFLAGS: "-C target-feature=+crt-static"
BUILD_CMD: cargo
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
- { target: arm-unknown-linux-musleabi, os: ubuntu-24.04, use-cross: true }
- { target: armv7-unknown-linux-musleabi, os: ubuntu-24.04, use-cross: true }
- { target: x86_64-apple-darwin, os: macos-14 }
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Populate cache
uses: ./.github/workflows/cache
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: |
echo "BUILD_CMD=cross" >> $GITHUB_ENV
RUSTFLAGS="-C target-feature=-crt-static" cargo install cross --git https://github.com/cross-rs/cross
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.job.target }}
- run: $BUILD_CMD build -p backhand-cli --bin add-backhand --bin replace-backhand --features xz-static --locked --target ${{ matrix.job.target }} --profile=dist
- run: $BUILD_CMD build -p backhand-cli --bin unsquashfs-backhand --locked --target ${{ matrix.job.target }} --profile=dist --no-default-features --features zstd,xz-static,gzip
- name: archive
run: |
tar -czvf backhand-${{ matrix.job.target }}.tar.gz \
-C target/${{ matrix.job.target }}/dist/ $BINS
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: backhand-${{ matrix.job.target }}.tar.gz
path: backhand-${{ matrix.job.target }}.tar.gz
# check semvar before release!
- name: Check semver
env:
# disable static build for this job
RUSTFLAGS: ""
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: obi1kenobi/cargo-semver-checks-action@c7306483f698c511eaf7416d1bf2e1958c90140f # v2.4
with:
package: backhand
feature-group: default-features
- name: Upload binary to release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: backhand-${{ matrix.job.target }}.tar.gz
asset_name: backhand-${{ github.ref_name }}-${{ matrix.job.target }}.tar.gz
tag: ${{ github.ref }}
prerelease: true
overwrite: true