-
Notifications
You must be signed in to change notification settings - Fork 3
134 lines (113 loc) · 3.93 KB
/
release.yaml
File metadata and controls
134 lines (113 loc) · 3.93 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
name: Release Sbuilder Tools
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.build.NAME }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build:
- {
NAME: x86_64-linux,
TARGET: x86_64-unknown-linux-musl,
}
- {
NAME: aarch64-linux,
TARGET: aarch64-unknown-linux-musl,
}
- {
NAME: riscv64-linux,
TARGET: riscv64gc-unknown-linux-musl
}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version
run: |
if [ -n "${{ inputs.version }}" ]; then
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
fi
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends musl-tools b3sum
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.build.TARGET }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.build.TARGET }}
- name: Build all binaries
run: |
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --locked --target ${{ matrix.build.TARGET }}
- name: Prepare release artifacts
run: |
mkdir -p release
# sbuild
if [ -f "target/${{ matrix.build.TARGET }}/release/sbuild" ]; then
cp "target/${{ matrix.build.TARGET }}/release/sbuild" "release/sbuild-${{ matrix.build.NAME }}"
b3sum "release/sbuild-${{ matrix.build.NAME }}" > "release/sbuild-${{ matrix.build.NAME }}.b3sum"
fi
# sbuild-meta
if [ -f "target/${{ matrix.build.TARGET }}/release/sbuild-meta" ]; then
cp "target/${{ matrix.build.TARGET }}/release/sbuild-meta" "release/sbuild-meta-${{ matrix.build.NAME }}"
b3sum "release/sbuild-meta-${{ matrix.build.NAME }}" > "release/sbuild-meta-${{ matrix.build.NAME }}.b3sum"
fi
# sbuild-cache
if [ -f "target/${{ matrix.build.TARGET }}/release/sbuild-cache" ]; then
cp "target/${{ matrix.build.TARGET }}/release/sbuild-cache" "release/sbuild-cache-${{ matrix.build.NAME }}"
b3sum "release/sbuild-cache-${{ matrix.build.NAME }}" > "release/sbuild-cache-${{ matrix.build.NAME }}.b3sum"
fi
ls -lah release/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.build.NAME }}
path: release/*
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
merge-multiple: true
- name: Set version
run: |
if [ -n "${{ inputs.version }}" ]; then
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
fi
- name: List artifacts
run: ls -lah artifacts/
- name: Update latest release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/*
file_glob: true
overwrite: true
tag: latest
release_name: "sbuilder (latest)"
prerelease: true
body: |
## Latest Development Build
This is a prerelease with the latest builds.
For stable releases, use versioned tags (e.g., `v${{ env.VERSION }}`).