Skip to content

Commit 1d544b3

Browse files
authored
simplify release CI and create archives in releases (#62)
* update release CI to match self_update and simplify yaml * add back concurrency option * adjust install script to deal with new tarfiles
1 parent b819fe3 commit 1d544b3

6 files changed

Lines changed: 117 additions & 321 deletions

File tree

.github/workflows/publish.yml

Lines changed: 83 additions & 253 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,70 @@
11
name: Publish
22
on:
33
push:
4+
branches:
5+
- "main"
46
tags:
57
- "v*"
6-
branches:
7-
- main
8-
8+
workflow_dispatch:
99
concurrency:
1010
group: publish-${{ github.event.pull_request.number || github.ref }}
1111
cancel-in-progress: true
12-
12+
env:
13+
GITHUB_TOKEN: ${{ github.token }}
14+
RUST_BACKTRACE: 1
1315
jobs:
14-
publish-linux:
15-
runs-on: ubuntu-latest
16+
release:
17+
name: Release - ${{ matrix.platform.os_name }}
18+
env:
19+
RNK_RELEASE_VERSION: ${{ github.ref_name }}
1620
strategy:
17-
fail-fast: true
1821
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
22+
platform:
23+
- os_name: Linux-x86_64
4124
os: ubuntu-latest
4225
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
26+
bin: rnk
27+
name: rnk-x86_64-unknown-linux-musl-${{RNK_RELEASE_VERSION}}.tar.gz
28+
cargo_command: cargo
4929

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
30+
- os_name: Linux-aarch64
31+
os: ubuntu-24.04-arm
32+
target: aarch64-unknown-linux-musl
33+
bin: rnk
34+
name: rnk-aarch64-unknown-linux-musl-${{RNK_RELEASE_VERSION}}.tar.gz
35+
cargo_command: cargo
36+
37+
- os_name: Windows-x86_64
38+
os: windows-latest
39+
target: x86_64-pc-windows-msvc
40+
bin: rnk.exe
41+
name: rnk-x86_64-pc-windows-msvc-${{RNK_RELEASE_VERSION}}.zip
42+
cargo_command: cargo
43+
44+
- os_name: macOS-x86_64
45+
os: macOS-latest
46+
target: x86_64-apple-darwin
47+
bin: rnk
48+
name: rnk-x86_64-apple-darwin-${{RNK_RELEASE_VERSION}}.tar.gz
49+
cargo_command: cargo
6050

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
51+
- os_name: macOS-aarch64
52+
os: macOS-latest
53+
target: aarch64-apple-darwin
54+
bin: rnk
55+
name: rnk-aarch64-apple-darwin-${{RNK_RELEASE_VERSION}}.tar.gz
56+
cargo_command: cargo
7457

75-
- name: Install Rust toolchain
76-
uses: actions-rs/toolchain@v1
58+
runs-on: ${{ matrix.platform.os }}
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v5
62+
- name: Strip version leading v
63+
run: echo "RNK_RELEASE_VERSION=${RNK_RELEASE_VERSION##v}" >> $GITHUB_ENV
64+
- name: Install toolchain
65+
uses: dtolnay/rust-toolchain@stable
7766
with:
78-
toolchain: stable
79-
target: ${{ matrix.target }}
80-
override: true
81-
default: true
82-
67+
targets: ${{ matrix.platform.target }}
8368
- name: Show version information (Rust, cargo, GCC)
8469
shell: bash
8570
run: |
@@ -89,201 +74,46 @@ jobs:
8974
rustup default
9075
cargo -V
9176
rustc -V
92-
- name: Build
93-
uses: actions-rs/cargo@v1
77+
- name: Rust cache
78+
uses: Swatinem/rust-cache@v2
9479
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
80+
prefix-key: "v0-rust"
81+
cache-workspace-crates: "true"
82+
- name: Install build dependencies on Linux
83+
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools openssl libssl-dev
84+
if: contains(matrix.platform.os, 'ubuntu')
85+
- name: Build binary (*nix)
10186
shell: bash
10287
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
160-
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
172-
shell: bash
88+
${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }}
89+
if: ${{ !contains(matrix.platform.os, 'windows') }}
90+
- name: Build binary (Windows)
91+
# We have to use the platform's native shell. If we use bash on
92+
# Windows then OpenSSL complains that the Perl it finds doesn't use
93+
# the platform's native paths and refuses to build.
94+
shell: powershell
17395
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
96+
& ${{ matrix.platform.cargo_command }} build --locked --release --target ${{ matrix.platform.target }}
97+
if: contains(matrix.platform.os, 'windows')
98+
- name: Package as archive
18499
shell: bash
185100
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
197-
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
244-
shell: bash
245-
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
101+
cd target/${{ matrix.platform.target }}/release
102+
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
103+
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
251104
else
252-
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
105+
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
253106
fi
254-
255-
- name: Build
256-
uses: actions-rs/cargo@v1
257-
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
267-
uses: softprops/action-gh-release@v1
268-
if: startsWith(github.ref, 'refs/tags/')
269-
env:
270-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
cd -
108+
- uses: actions/upload-artifact@v4
271109
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"
110+
name: "${{matrix.platform.os_name}}"
111+
path: |
112+
rnk*.gz
113+
rnk*.zip
114+
- name: Publish GitHub release
115+
uses: softprops/action-gh-release@v2
281116
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
117+
draft: true
118+
files: "rnk*"
119+
if: startsWith( github.ref, 'refs/tags/v' )

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)