11name : Publish
22on :
33 push :
4+ branches :
5+ - " main"
46 tags :
57 - " v*"
6- branches :
7- - main
8-
9- concurrency :
10- group : publish-${{ github.event.pull_request.number || github.ref }}
11- cancel-in-progress : true
8+ workflow_dispatch :
129
10+ env :
11+ GITHUB_TOKEN : ${{ github.token }}
12+ RUST_BACKTRACE : 1
1313jobs :
14- publish-linux :
15- runs-on : ubuntu-latest
14+ release :
15+ name : Release - ${{ matrix.platform.os_name }}
16+ env :
17+ RNK_RELEASE_VERSION : ${{ github.event.release.tag_name }}
1618 strategy :
17- fail-fast : true
1819 matrix :
19- build :
20- - aarch64
21- - aarch64-musl
22- - amd64-musl
23- - amd64
24- include :
25- - build : aarch64
26- os : ubuntu-latest
27- target : aarch64-unknown-linux-gnu
28- use-cross : true
29- features : " --no-default-features --features rustls"
30- - build : aarch64-musl
31- os : ubuntu-latest
32- target : aarch64-unknown-linux-musl
33- use-cross : true
34- features : " --no-default-features --features rustls"
35- - build : amd64
36- os : ubuntu-latest
37- target : x86_64-unknown-linux-gnu
38- use-cross : false
39- features : " "
40- - build : amd64-musl
20+ platform :
21+ - os_name : Linux-x86_64
4122 os : ubuntu-latest
4223 target : x86_64-unknown-linux-musl
43- use-cross : true
44- features : " --no-default-features --features rustls"
45- steps :
46- - uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
47- with :
48- fetch-depth : 0
24+ bin : rnk
25+ name : rnk-x86_64-unknown-linux-musl-${{RNK_RELEASE_VERSION}}.tar.gz
26+ cargo_command : cargo
4927
50- - name : Install prerequisites
51- shell : bash
52- run : |
53- sudo apt-get -y update
54- case ${{ matrix.target }} in
55- arm-unknown-linux-gnueabihf) sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
56- aarch64-unknown-linux-gnu) sudo apt-get -y install gcc-aarch64-linux-gnu ;;
57- aarch64-unknown-linux-musl) sudo apt-get -y install gcc-aarch64-linux-gnu ;;
58- esac
59- sudo apt-get -y install libssl-dev openssl pkg-config
28+ - os_name : Linux-aarch64
29+ os : ubuntu-24.04-arm
30+ target : aarch64-unknown-linux-musl
31+ bin : rnk
32+ name : rnk-aarch64-unknown-linux-musl-${{RNK_RELEASE_VERSION}}.tar.gz
33+ cargo_command : cargo
34+
35+ - os_name : Windows-x86_64
36+ os : windows-latest
37+ target : x86_64-pc-windows-msvc
38+ bin : rnk.exe
39+ name : rnk-x86_64-pc-windows-msvc-${{RNK_RELEASE_VERSION}}.zip
40+ cargo_command : cargo
41+
42+ - os_name : macOS-x86_64
43+ os : macOS-latest
44+ target : x86_64-apple-darwin
45+ bin : rnk
46+ name : rnk-x86_64-apple-darwin-${{RNK_RELEASE_VERSION}}.tar.gz
47+ cargo_command : cargo
6048
61- - name : Extract crate information
62- shell : bash
63- run : |
64- echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
65- echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
66- echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
67- PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
68- echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
69- if [[ $PROJECT_VERSION == *-pre ]]; then
70- echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
71- else
72- echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
73- fi
49+ - os_name : macOS-aarch64
50+ os : macOS-latest
51+ target : aarch64-apple-darwin
52+ bin : rnk
53+ name : rnk-aarch64-apple-darwin-${{RNK_RELEASE_VERSION}}.tar.gz
54+ cargo_command : cargo
7455
75- - name : Install Rust toolchain
76- uses : actions-rs/toolchain@v1
56+ runs-on : ${{ matrix.platform.os }}
57+ steps :
58+ - name : Checkout
59+ uses : actions/checkout@v5
60+ - name : Strip version leading v
61+ run : echo "RNK_RELEASE_VERSION=${RNK_RELEASE_VERSION##v}" >> $GITHUB_ENV
62+ - name : Install toolchain
63+ uses : dtolnay/rust-toolchain@stable
7764 with :
78- toolchain : stable
79- target : ${{ matrix.target }}
80- override : true
81- default : true
82-
65+ targets : ${{ matrix.platform.target }}
8366 - name : Show version information (Rust, cargo, GCC)
8467 shell : bash
8568 run : |
@@ -89,201 +72,46 @@ jobs:
8972 rustup default
9073 cargo -V
9174 rustc -V
92- - name : Build
93- uses : actions-rs/cargo@v1
94- with :
95- use-cross : ${{ matrix.use-cross }}
96- command : build
97- args : ${{ matrix.features }} --release --target=${{ matrix.target }}
98-
99- - name : set bin path
100- id : bin-path
101- shell : bash
102- run : |
103- # Setup paths
104- BIN_DIR="_cicd/release-bin/"
105- mkdir -p "${BIN_DIR}"
106- BIN_NAME="${{ env.PROJECT_NAME }}"
107- BIN_PATH="${BIN_DIR}/${BIN_NAME}_${{ matrix.build }}-${{ env.VERSION_SUFFIX }}"
108- # Copy the release build binary to the result location
109- cp "target/${{ matrix.target }}/release/${BIN_NAME}" "${BIN_PATH}"
110- # Let subsequent steps know where to find the bin
111- echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT
112-
113- - name : Publish Release
114- id : publish
115- uses : softprops/action-gh-release@v1
116- if : startsWith(github.ref, 'refs/tags/')
117- env :
118- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
119- with :
120- files : |
121- ${{ steps.bin-path.outputs.BIN_PATH }}
122-
123- - name : Publish Pre-Release
124- id : publish-pre
125- if : ${{ github.ref }} == 'refs/heads/main'
126- env :
127- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128- uses : " ncipollo/release-action@v1"
129- with :
130- token : " ${{ secrets.GITHUB_TOKEN }}"
131- prerelease : true
132- allowUpdates : true
133- tag : " nightly"
134- commit : " main"
135- name : " renku-cli nightly"
136- replacesArtifacts : true
137- artifacts : ${{ steps.bin-path.outputs.BIN_PATH }}
138-
139- publish-mac :
140- runs-on : macos-latest
141-
142- strategy :
143- fail-fast : true
144- matrix :
145- build :
146- - aarch64
147- - amd64
148- include :
149- - build : amd64
150- target : x86_64-apple-darwin
151- use-cross : true
152- features : " "
153- - build : aarch64
154- target : aarch64-apple-darwin
155- use-cross : false
156- features : " "
157- steps :
158- - name : Checkout
159- uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
75+ - name : Rust cache
76+ uses : Swatinem/rust-cache@v2
16077 with :
161- fetch-depth : 0
162-
163- - name : Install Rust toolchain
164- uses : actions-rs/toolchain@v1
165- with :
166- toolchain : stable
167- target : ${{ matrix.target }}
168- override : true
169- default : true
170-
171- - name : Extract crate information
78+ prefix-key : " v0-rust"
79+ cache-workspace-crates : " true"
80+ - name : Install build dependencies on Linux
81+ run : sudo apt-get update --yes && sudo apt-get install --yes musl-tools openssl libssl-dev
82+ if : contains(matrix.platform.os, 'ubuntu')
83+ - name : Build binary (*nix)
17284 shell : bash
17385 run : |
174- echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
175- PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
176- echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
177- if [[ $PROJECT_VERSION == *-pre ]]; then
178- echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
179- else
180- echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
181- fi
182-
183- - name : Add build env parameters
184- shell : bash
185- run : |
186- echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
187- echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun --show-sdk-platform-version)" >> $GITHUB_ENV
188-
189- - name : Build
190- uses : actions-rs/cargo@v1
191- with :
192- use-cross : ${{ matrix.use-cross }}
193- command : build
194- args : ${{ matrix.features }} --release --target=${{ matrix.target }}
195-
196- - name : Rename binary
86+ ${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }}
87+ if : ${{ !contains(matrix.platform.os, 'windows') }}
88+ - name : Build binary (Windows)
89+ # We have to use the platform's native shell. If we use bash on
90+ # Windows then OpenSSL complains that the Perl it finds doesn't use
91+ # the platform's native paths and refuses to build.
92+ shell : powershell
19793 run : |
198- mv target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }} target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }}
199-
200- - name : Publish Release
201- id : publish
202- uses : softprops/action-gh-release@v1
203- if : startsWith(github.ref, 'refs/tags/')
204- env :
205- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
206- with :
207- prerelease : ${{ github.ref }} == "refs/heads/main"
208- files : |
209- target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }}
210-
211- - name : Publish Pre-Release
212- id : publish-pre
213- if : ${{ github.ref }} == 'refs/heads/main'
214- env :
215- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
216- uses : " ncipollo/release-action@v1"
217- with :
218- token : " ${{ secrets.GITHUB_TOKEN }}"
219- prerelease : true
220- allowUpdates : true
221- tag : " nightly"
222- commit : " main"
223- name : " renku-cli nightly"
224- replacesArtifacts : true
225- artifacts : target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }}
226-
227- publish-win :
228- runs-on : windows-latest
229-
230- steps :
231- - name : Checkout
232- uses : actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
233- with :
234- fetch-depth : 0
235-
236- - name : Install Rust toolchain
237- uses : actions-rs/toolchain@v1
238- with :
239- toolchain : stable
240- override : true
241- default : true
242-
243- - name : Extract crate information
94+ & ${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }}
95+ if : contains(matrix.platform.os, 'windows')
96+ - name : Package as archive
24497 shell : bash
24598 run : |
246- echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
247- PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
248- echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
249- if [[ $PROJECT_VERSION == *-pre ]]; then
250- echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
99+ cd target/${{ matrix.platform.target }}/release
100+ if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
101+ 7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
251102 else
252- echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
103+ tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
253104 fi
254-
255- - name : Build
256- uses : actions-rs/cargo@v1
105+ cd -
106+ - uses : actions/upload-artifact@v4
257107 with :
258- command : build
259- args : ${{ matrix.features }} --release
260-
261- - name : Rename binary
262- run : |
263- mv target/release/${{ env.PROJECT_NAME }}.exe target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe
264-
265- - name : Publish Release
266- id : publish
108+ name : " ${{matrix.platform.os_name}}"
109+ path : |
110+ rnk*.gz
111+ rnk*.zip
112+ - name : Publish GitHub release
267113 uses : softprops/action-gh-release@v1
268- if : startsWith(github.ref, 'refs/tags/')
269- env :
270- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
271- with :
272- files : |
273- target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe
274-
275- - name : Publish Pre-Release
276- id : publish-pre
277- if : ${{ github.ref }} == 'refs/heads/main'
278- env :
279- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
280- uses : " ncipollo/release-action@v1"
281114 with :
282- token : " ${{ secrets.GITHUB_TOKEN }}"
283- prerelease : true
284- allowUpdates : true
285- tag : " nightly"
286- commit : " main"
287- name : " renku-cli nightly"
288- replacesArtifacts : true
289- artifacts : target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe
115+ draft : true
116+ files : " rnk*"
117+ if : startsWith( github.ref, 'refs/tags/v' )
0 commit comments