-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (219 loc) · 8.63 KB
/
Copy pathrelease.yml
File metadata and controls
247 lines (219 loc) · 8.63 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
linux:
name: Linux ${{ matrix.label }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
label: x86_64
rust_target: x86_64-unknown-linux-gnu
deb_arch: amd64
appimage_arch: x86_64
- runner: ubuntu-24.04-arm
label: aarch64
rust_target: aarch64-unknown-linux-gnu
deb_arch: arm64
appimage_arch: aarch64
steps:
- uses: actions/checkout@v4
- name: Resolve release version
id: version
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
CARGO_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
if [[ -z "${VERSION}" || -z "${CARGO_VERSION}" ]]; then
echo "failed to resolve version metadata" >&2
exit 1
fi
if [[ "${VERSION}" != "${CARGO_VERSION}" ]]; then
echo "tag version ${VERSION} does not match Cargo.toml version ${CARGO_VERSION}" >&2
exit 1
fi
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-linux-${{ matrix.label }}
cache-on-failure: true
- name: Cache cargo-deb
id: cache-cargo-deb
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-deb
key: cargo-deb-${{ runner.os }}-${{ runner.arch }}-locked
- name: Install Linux build dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
curl \
file \
fuse \
imagemagick \
pkg-config \
libasound2-dev \
libfontconfig1-dev \
libfreetype6-dev \
libssl-dev \
libudev-dev \
libwayland-dev \
libx11-dev \
libx11-xcb-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxcb1-dev \
libxcursor-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
zsync
- name: Install cargo-deb
if: steps.cache-cargo-deb.outputs.cache-hit != 'true'
shell: bash
run: cargo install cargo-deb --locked
- name: Cache linuxdeploy tools
id: cache-linuxdeploy
uses: actions/cache@v4
with:
path: |
linuxdeploy.AppImage
linuxdeploy-plugin-appimage.AppImage
key: linuxdeploy-${{ runner.os }}-${{ matrix.appimage_arch }}-continuous-2026-04-10
- name: Build release binary
shell: bash
run: cargo build --release --target ${{ matrix.rust_target }}
- name: Package tarball
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
mkdir -p dist/stage
install -Dm755 "target/${{ matrix.rust_target }}/release/orbitshell" "dist/stage/orbitshell"
install -Dm755 installer/linux/install.sh "dist/stage/install.sh"
tar -C dist/stage -czf "dist/orbitshell-${VERSION}-linux-${{ matrix.label }}.tar.gz" .
- name: Build deb package
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
mkdir -p dist
cargo deb \
--no-build \
--target "${{ matrix.rust_target }}" \
--output "dist/orbitshell_${VERSION}_${{ matrix.deb_arch }}.deb"
- name: Build AppImage
shell: bash
env:
ARCH: ${{ matrix.appimage_arch }}
run: |
VERSION="${{ steps.version.outputs.version }}"
mkdir -p AppDir/usr/bin AppDir/usr/share/applications AppDir/usr/share/icons/hicolor/512x512/apps AppDir/usr/share/metainfo dist
install -Dm755 packaging/linux/AppRun AppDir/AppRun
install -Dm755 "target/${{ matrix.rust_target }}/release/orbitshell" "AppDir/usr/bin/orbitshell"
install -Dm644 packaging/linux/dev.carlosmiguel.orbitshell.desktop "AppDir/usr/share/applications/dev.carlosmiguel.orbitshell.desktop"
install -Dm644 packaging/linux/dev.carlosmiguel.orbitshell.metainfo.xml "AppDir/usr/share/metainfo/dev.carlosmiguel.orbitshell.metainfo.xml"
install -Dm644 packaging/linux/orbitshell-icon.png "AppDir/usr/share/icons/hicolor/512x512/apps/orbitshell.png"
if [[ ! -f linuxdeploy.AppImage ]]; then
curl -L -o linuxdeploy.AppImage "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${{ matrix.appimage_arch }}.AppImage"
fi
if [[ ! -f linuxdeploy-plugin-appimage.AppImage ]]; then
curl -L -o linuxdeploy-plugin-appimage.AppImage "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-${{ matrix.appimage_arch }}.AppImage"
fi
chmod +x linuxdeploy.AppImage linuxdeploy-plugin-appimage.AppImage
APPIMAGE_EXTRACT_AND_RUN=1 ./linuxdeploy.AppImage \
--appdir AppDir \
-e "AppDir/usr/bin/orbitshell" \
-d "AppDir/usr/share/applications/dev.carlosmiguel.orbitshell.desktop" \
-i "AppDir/usr/share/icons/hicolor/512x512/apps/orbitshell.png" \
--output appimage
APPIMAGE_OUTPUT="$(find . -maxdepth 1 -type f -name '*.AppImage' ! -name 'linuxdeploy*.AppImage' | head -n 1)"
if [[ -z "${APPIMAGE_OUTPUT}" ]]; then
echo "failed to locate generated AppImage artifact" >&2
exit 1
fi
mv "${APPIMAGE_OUTPUT}" "dist/OrbitShell-${VERSION}-${{ matrix.label }}.AppImage"
- uses: actions/upload-artifact@v4
with:
name: release-linux-${{ matrix.label }}
path: dist/*
windows:
name: Windows x86_64
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Resolve release version
id: version
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
CARGO_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
if [[ -z "${VERSION}" || -z "${CARGO_VERSION}" ]]; then
echo "failed to resolve version metadata" >&2
exit 1
fi
if [[ "${VERSION}" != "${CARGO_VERSION}" ]]; then
echo "tag version ${VERSION} does not match Cargo.toml version ${CARGO_VERSION}" >&2
exit 1
fi
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-windows-x86_64
cache-on-failure: true
- name: Install NSIS
shell: powershell
run: choco install nsis -y --no-progress
- name: Build release binary
shell: powershell
run: cargo build --release
- name: Package Windows artifacts
shell: powershell
run: |
$version = "${{ steps.version.outputs.version }}"
New-Item -ItemType Directory -Force -Path dist | Out-Null
Copy-Item target\release\orbitshell.exe "dist\orbitshell-$version-windows-x86_64.exe"
Push-Location installer\windows
makensis /DAPP_VERSION=$version /DOUTPUT_NAME=OrbitShell-Setup-$version-x86_64.exe orbitshell.nsi
Pop-Location
Copy-Item "installer\windows\OrbitShell-Setup-$version-x86_64.exe" "dist\OrbitShell-Setup-$version-x86_64.exe"
- uses: actions/upload-artifact@v4
with:
name: release-windows-x86_64
path: dist\*
publish:
name: Publish GitHub Release
runs-on: ubuntu-24.04
needs:
- linux
- windows
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: release-*
merge-multiple: true
- name: Create or update release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
gh release view "${TAG}" --repo "${GH_REPO}" >/dev/null 2>&1 || gh release create "${TAG}" --repo "${GH_REPO}" --title "${TAG}" --generate-notes
mapfile -t ASSETS < <(find dist -maxdepth 1 -type f | sort)
if [[ ${#ASSETS[@]} -eq 0 ]]; then
echo "no release assets found in dist/" >&2
exit 1
fi
gh release upload "${TAG}" --repo "${GH_REPO}" --clobber "${ASSETS[@]}"