Repository navigation
126 lines (112 loc) · 3.39 KB
/
Copy pathrelease.yml
File metadata and controls
126 lines (112 loc) · 3.39 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
# Build and publish product binaries to GitHub Releases.
#
# Trigger: push a version tag (v0.1.0) or run manually from Actions.
# Assets: stumble-{macos|linux}-{arm64|x86_64}.tar.gz + SHA256SUMS + install.sh
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
jobs:
build:
name: ${{ matrix.asset }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset: linux-x86_64
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
asset: linux-arm64
- os: macos-14
target: aarch64-apple-darwin
asset: macos-arm64
- os: macos-14
target: x86_64-apple-darwin
asset: macos-x86_64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: release-${{ matrix.target }}
- name: Build release binaries
run: |
cargo build --release --locked -p stumble-cli \
--bin stumble --bin stumble-api --bin stumble-runner \
--target "${{ matrix.target }}"
- name: Package tarball
shell: bash
run: |
set -euo pipefail
stage="stumble-${{ matrix.asset }}"
mkdir -p "$stage"
for bin in stumble stumble-api stumble-runner; do
src="target/${{ matrix.target }}/release/${bin}"
# Prefer fully stripped names on Unix when available.
if command -v strip >/dev/null 2>&1; then
strip "$src" || true
fi
cp "$src" "${stage}/${bin}"
chmod 755 "${stage}/${bin}"
done
tar -czf "${stage}.tar.gz" "$stage"
ls -lh "${stage}.tar.gz"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: stumble-${{ matrix.asset }}
path: stumble-${{ matrix.asset }}.tar.gz
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout (for install.sh)
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Assemble release files
shell: bash
run: |
set -euo pipefail
mkdir -p release
mv dist/stumble-*.tar.gz release/
cp scripts/install.sh release/install.sh
chmod 755 release/install.sh
(
cd release
sha256sum stumble-*.tar.gz install.sh > SHA256SUMS
)
ls -lh release/
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
files: |
release/stumble-*.tar.gz
release/install.sh
release/SHA256SUMS
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}