-
Notifications
You must be signed in to change notification settings - Fork 123
176 lines (143 loc) · 5.83 KB
/
release.yml
File metadata and controls
176 lines (143 loc) · 5.83 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Release
on:
push:
tags: ["v*"]
env:
CARGO_TERM_COLOR: always
jobs:
# ── Matrix build ─────────────────────────────────────────────────────────
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: ""
archive: tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
ext: ""
archive: tar.gz
- os: macos-latest
target: aarch64-apple-darwin
ext: ""
archive: tar.gz
- os: macos-latest
target: x86_64-apple-darwin
ext: ""
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: ".exe"
archive: zip
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: release-${{ matrix.target }}
# Cross-compiling aarch64-unknown-linux-gnu needs an explicit gcc cross-toolchain.
- name: Install cross-compilation toolchain (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross
- name: Set cross-compilation env (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> "$GITHUB_ENV"
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
- name: Build release binary (x86_64 Linux)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: cargo build --release --target ${{ matrix.target }} -p devo-cli
- name: Build release binary (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: cargo build --release --target ${{ matrix.target }} -p devo-cli
- name: Build release binary (macOS)
if: runner.os == 'macOS'
run: cargo build --release --target ${{ matrix.target }} -p devo-cli
- name: Build release binary (Windows)
if: runner.os == 'Windows'
run: cargo build --release --target ${{ matrix.target }} -p devo-cli
- name: Strip symbols (x86_64 Linux)
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: strip target/${{ matrix.target }}/release/devo${{ matrix.ext }}
- name: Strip symbols (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: aarch64-linux-gnu-strip target/${{ matrix.target }}/release/devo${{ matrix.ext }}
- name: Strip symbols (macOS)
if: runner.os == 'macOS'
run: strip target/${{ matrix.target }}/release/devo${{ matrix.ext }}
- name: Prepare staging directory
shell: bash
run: |
staging=devo-${{ github.ref_name }}-${{ matrix.target }}
mkdir -p "$staging"
cp target/${{ matrix.target }}/release/devo${{ matrix.ext }} "$staging/"
cp README.md LICENSE "$staging/" 2>/dev/null || true
echo "STAGING=$staging" >> "$GITHUB_ENV"
- name: Create tar.gz archive (Linux/macOS)
if: runner.os != 'Windows'
run: tar czf "${{ env.STAGING }}.tar.gz" "${{ env.STAGING }}"
- name: Create zip archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$staging = "$env:STAGING"
Compress-Archive -Path "$staging/*" -DestinationPath "$staging.zip"
- uses: actions/upload-artifact@v4
with:
name: devo-${{ github.ref_name }}-${{ matrix.target }}
path: devo-${{ github.ref_name }}-${{ matrix.target }}.*
# ── Create GitHub Release ──────────────────────────────────────────────
release:
name: Create Release
needs: build
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts
- name: Generate release notes
run: |
cat > release-notes.md <<- NOTES
## Install
### Build from source
\`\`\`bash
git clone https://github.com/${{ github.repository }}.git
cd devo
cargo build --release
# Linux / macOS
./target/release/devo onboard
# Windows
.\\target\\release\\devo onboard
\`\`\`
### Prebuilt binary
Download the archive for your platform from the Assets section below, extract it, and place the \`devo\` (or \`devo.exe\` on Windows) binary somewhere in your \`PATH\`.
Supported platforms:
- Linux x86_64 (\`x86_64-unknown-linux-gnu\`)
- Linux ARM64 (\`aarch64-unknown-linux-gnu\`)
- macOS Intel (\`x86_64-apple-darwin\`)
- macOS Apple Silicon (\`aarch64-apple-darwin\`)
- Windows x86_64 (\`x86_64-pc-windows-msvc\`)
---
Full changelog at [commits](https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}).
NOTES
- name: Create release
uses: softprops/action-gh-release@v2
with:
body_path: release-notes.md
draft: true
files: artifacts/*
generate_release_notes: true