-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (139 loc) · 4.54 KB
/
Copy pathrelease.yml
File metadata and controls
162 lines (139 loc) · 4.54 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-cli:
name: CLI ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-latest
use_cross: false
- target: x86_64-apple-darwin
runner: macos-latest
use_cross: false
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
use_cross: false
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
use_cross: true
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.target }}-cargo-release-
- name: Build release binary
run: |
if [ "${{ matrix.use_cross }}" = "true" ]; then
cross build --release -p kyu-graph-cli --target ${{ matrix.target }}
else
cargo build --release -p kyu-graph-cli --target ${{ matrix.target }}
fi
- name: Determine version
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Package tarball
run: |
ARCHIVE_NAME="kyu-graph-cli-${{ steps.version.outputs.version }}-${{ matrix.target }}"
mkdir -p staging
cp "target/${{ matrix.target }}/release/kyu-graph-cli" staging/
cd staging
tar czf "../${ARCHIVE_NAME}.tar.gz" "kyu-graph-cli"
cd ..
shasum -a 256 "${ARCHIVE_NAME}.tar.gz" > "${ARCHIVE_NAME}.tar.gz.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: kyu-graph-cli-${{ matrix.target }}
path: |
*.tar.gz
*.sha256
build-viz:
name: Viz ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-apple-darwin
runner: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-viz-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.target }}-cargo-viz-
- name: Build kyu-viz release binary
run: cargo build --release -p kyu-visualizer --target ${{ matrix.target }}
- name: Determine version
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Package tarball
run: |
ARCHIVE_NAME="kyu-viz-${{ steps.version.outputs.version }}-${{ matrix.target }}"
mkdir -p staging
cp "target/${{ matrix.target }}/release/kyu-viz" staging/
cd staging
tar czf "../${ARCHIVE_NAME}.tar.gz" "kyu-viz"
cd ..
shasum -a 256 "${ARCHIVE_NAME}.tar.gz" > "${ARCHIVE_NAME}.tar.gz.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: kyu-viz-${{ matrix.target }}
path: |
*.tar.gz
*.sha256
release:
name: Create GitHub Release
needs: [build-cli, build-viz]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}