Skip to content

Commit d029bbc

Browse files
committed
Merge branch 'main' into image_viewer#327
2 parents 440bde3 + 0a7263e commit d029bbc

32 files changed

+3116
-407
lines changed

.github/workflows/release.yml

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
# Robrix Release CI Workflow
2+
3+
name: Robrix Release CI
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v*.*.*' # Release Version Tags
9+
- 'v*.*.*-*' # Pre-release Version Tags
10+
workflow_dispatch:
11+
inputs:
12+
target_platforms:
13+
description: 'Target platforms for the release'
14+
required: true
15+
type: choice
16+
options:
17+
- 'All' # Build for all platforms
18+
- 'linux-ubuntu-24.04' # Build for Ubuntu 24.04 both x86_64 and aarch64
19+
- 'linux-ubuntu-24.04-x86_64' # Build for Ubuntu 24.04 x86_64
20+
- 'linux-ubuntu-24.04-aarch64' # Build for Ubuntu 24.04 aarch64
21+
- 'linux-ubuntu-22.04' # Build for Ubuntu 22.04 both x86_64 and aarch64
22+
- 'linux-ubuntu-22.04-x86_64' # Build for Ubuntu 22.04 x86_64
23+
- 'linux-ubuntu-22.04-aarch64' # Build for Ubuntu 22.04 aarch64
24+
- 'macos-14-aarch64' # Build for MacOS 14 (Apple Silicon)
25+
- 'macos-13-x86_64' # Build for MacOS 13 (Intel)
26+
- 'windows-2022-x86_64' # Build for Windows 2022 x86_64
27+
release_tag:
28+
description: 'Release tag (required if creating release)'
29+
required: false
30+
type: string
31+
default: ''
32+
create_release:
33+
description: 'Create a GitHub Release'
34+
required: true
35+
type: boolean
36+
default: false
37+
pre_release:
38+
description: 'Mark as a pre-release'
39+
required: true
40+
type: boolean
41+
default: false
42+
43+
permissions: write-all
44+
env:
45+
CARGO_INCREMENTAL: 0
46+
RUST_BACKTRACE: short
47+
48+
concurrency:
49+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
50+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
51+
52+
jobs:
53+
check_tag_version:
54+
name: Check Release Tag and Cargo.toml Version Consistency
55+
runs-on: ubuntu-latest
56+
if: github.event_name == 'push'
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Check tag and Cargo.toml version
61+
run: |
62+
TAG_REF="${GITHUB_REF##*/}"
63+
echo "Current tag: $TAG_REF"
64+
65+
CARGO_MANIFEST_VERSION=$(cargo metadata --no-deps --format-version 1 --frozen | jq -r '.packages[0].version')
66+
echo "Cargo.toml Robrix version: $CARGO_MANIFEST_VERSION"
67+
68+
if [[ "$TAG_REF" != "v$CARGO_MANIFEST_VERSION" ]]; then
69+
echo "Error: Tag '$TAG_REF' does not match Cargo.toml version '$CARGO_MANIFEST_VERSION'."
70+
echo "Please create a tag that matches the Cargo.toml version."
71+
exit 1
72+
else
73+
echo "Tag and Cargo.toml version are consistent."
74+
fi
75+
76+
determine_matrix:
77+
name: Determine Build Matrix
78+
runs-on: ubuntu-latest
79+
if: always() && (needs.check_tag_version.result == 'success' || github.event_name == 'workflow_dispatch')
80+
needs: check_tag_version
81+
outputs:
82+
matrix: ${{ steps.set-matrix.outputs.matrix }}
83+
steps:
84+
- name: Set build matrix
85+
id: set-matrix
86+
run: |
87+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
88+
case "${{ github.event.inputs.target_platforms }}" in
89+
"All")
90+
matrix='{"include":[{"os":"ubuntu-24.04","arch":"x86_64"},{"os":"ubuntu-24.04-arm","arch":"aarch64"},{"os":"ubuntu-22.04","arch":"x86_64"},{"os":"ubuntu-22.04-arm","arch":"aarch64"},{"os":"macos-14","arch":"aarch64"},{"os":"macos-13","arch":"x86_64"},{"os":"windows-2022","arch":"x86_64"}]}'
91+
;;
92+
"linux-ubuntu-24.04")
93+
matrix='{"include":[{"os":"ubuntu-24.04","arch":"x86_64"},{"os":"ubuntu-24.04-arm","arch":"aarch64"}]}'
94+
;;
95+
"linux-ubuntu-22.04")
96+
matrix='{"include":[{"os":"ubuntu-22.04","arch":"x86_64"},{"os":"ubuntu-22.04-arm","arch":"aarch64"}]}'
97+
;;
98+
"linux-ubuntu-24.04")
99+
matrix='{"include":[{"os":"ubuntu-24.04","arch":"x86_64"}]}'
100+
;;
101+
"linux-ubuntu-24.04-aarch64")
102+
matrix='{"include":[{"os":"ubuntu-24.04-arm","arch":"aarch64"}]}'
103+
;;
104+
"linux-ubuntu-22.04")
105+
matrix='{"include":[{"os":"ubuntu-22.04","arch":"x86_64"}]}'
106+
;;
107+
"linux-ubuntu-22.04-aarch64")
108+
matrix='{"include":[{"os":"ubuntu-22.04-arm","arch":"aarch64"}]}'
109+
;;
110+
"macos-14-aarch64")
111+
matrix='{"include":[{"os":"macos-14","arch":"aarch64"}]}'
112+
;;
113+
"macos-13-x86_64")
114+
matrix='{"include":[{"os":"macos-13","arch":"x86_64"}]}'
115+
;;
116+
"windows-2022-x86_64")
117+
matrix='{"include":[{"os":"windows-2022","arch":"x86_64"}]}'
118+
;;
119+
esac
120+
else
121+
matrix='{"include":[{"os":"ubuntu-24.04","arch":"x86_64"},{"os":"ubuntu-24.04-arm","arch":"aarch64"},{"os":"ubuntu-22.04","arch":"x86_64"},{"os":"ubuntu-22.04-arm","arch":"aarch64"},{"os":"macos-14","arch":"aarch64"},{"os":"macos-13","arch":"x86_64"},{"os":"windows-2022","arch":"x86_64"}]}'
122+
fi
123+
echo "matrix=$matrix" >> $GITHUB_OUTPUT
124+
125+
release_robrix_for_desktop:
126+
name: Release Robrix for Desktop (${{ matrix.os }}, ${{ matrix.arch }})
127+
needs: determine_matrix
128+
strategy:
129+
fail-fast: false
130+
matrix: ${{ fromJson(needs.determine_matrix.outputs.matrix) }}
131+
runs-on: ${{ matrix.os }}
132+
steps:
133+
- uses: actions/checkout@v4
134+
135+
- name: Install Linux necessary dependencies
136+
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm' || matrix.os == 'ubuntu-24.04' || matrix.os == 'ubuntu-24.04-arm'
137+
run: |
138+
sudo apt-get update
139+
sudo apt-get install -y \
140+
libssl-dev \
141+
libsqlite3-dev \
142+
pkg-config \
143+
llvm \
144+
clang \
145+
libclang-dev \
146+
binfmt-support \
147+
libxcursor-dev \
148+
libx11-dev \
149+
libasound2-dev \
150+
libpulse-dev
151+
152+
- name: Install Rust Stable
153+
uses: dtolnay/rust-toolchain@stable
154+
155+
- name: Install cargo-packager
156+
run: |
157+
cargo +stable install --force --locked cargo-packager
158+
159+
- name: Install robius-packaging-commands
160+
run: |
161+
cargo install --version 0.2.0 --locked --git https://github.com/project-robius/robius-packaging-commands.git robius-packaging-commands
162+
163+
- name: Build
164+
shell: bash
165+
run: |
166+
cargo packager --release
167+
ls ./dist
168+
169+
- name: Set Version
170+
run: |
171+
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.release_tag }}" ]]; then
172+
VERSION="${{ github.event.inputs.release_tag }}"
173+
VERSION="${VERSION#v}" # Remove 'v' prefix if present
174+
else
175+
VERSION=$(cargo metadata --no-deps --format-version 1 --frozen | jq -r '.packages[0].version')
176+
fi
177+
echo "VERSION=$VERSION" >> $GITHUB_ENV
178+
shell: bash
179+
180+
- name: Set Artifact and Upload Paths
181+
shell: bash
182+
run: |
183+
VERSION=${{ env.VERSION }}
184+
OS=${{ matrix.os }}
185+
ARCH=${{ matrix.arch }}
186+
187+
188+
if [[ "$OS" == "ubuntu-22.04" || "$OS" == "ubuntu-24.04" ]]; then
189+
{
190+
echo "DEB=robrix_${VERSION}_amd64.deb"
191+
echo "APPIMAGE=robrix_${VERSION}_x86_64.AppImage"
192+
echo "TAR=robrix_${VERSION}_x86_64.tar.gz"
193+
echo "UPLOAD_FILES<<EOF"
194+
echo "./dist/robrix_${VERSION}_amd64.deb"
195+
echo "./dist/robrix_${VERSION}_x86_64.AppImage"
196+
echo "./dist/robrix_${VERSION}_x86_64.tar.gz"
197+
echo "EOF"
198+
} >> $GITHUB_ENV
199+
200+
elif [[ "$OS" == "ubuntu-22.04-arm" || "$OS" == "ubuntu-24.04-arm" ]]; then
201+
{
202+
echo "DEB=robrix_${VERSION}_arm64.deb"
203+
echo "APPIMAGE=robrix_${VERSION}_aarch64.AppImage"
204+
echo "TAR=robrix_${VERSION}_aarch64.tar.gz"
205+
echo "UPLOAD_FILES<<EOF"
206+
echo "./dist/robrix_${VERSION}_arm64.deb"
207+
echo "./dist/robrix_${VERSION}_aarch64.AppImage"
208+
echo "./dist/robrix_${VERSION}_aarch64.tar.gz"
209+
echo "EOF"
210+
} >> $GITHUB_ENV
211+
212+
elif [[ "$OS" == "macos-14" ]]; then
213+
FILE="robrix-${VERSION}-macOS-${ARCH}.dmg"
214+
mv ./dist/Robrix_${VERSION}_aarch64.dmg ./dist/$FILE
215+
echo "RELEASE_FILE=$FILE" >> $GITHUB_ENV
216+
echo "UPLOAD_FILES=./dist/$FILE" >> $GITHUB_ENV
217+
218+
elif [[ "$OS" == "macos-13" ]]; then
219+
FILE="robrix-${VERSION}-macOS-${ARCH}.dmg"
220+
mv ./dist/Robrix_${VERSION}_x64.dmg ./dist/$FILE
221+
echo "RELEASE_FILE=$FILE" >> $GITHUB_ENV
222+
echo "UPLOAD_FILES=./dist/$FILE" >> $GITHUB_ENV
223+
224+
elif [[ "$OS" == "windows-2022" ]]; then
225+
FILE="robrix-${VERSION}-windows-${ARCH}-setup.exe"
226+
mv ./dist/robrix_${VERSION}_x64-setup.exe ./dist/$FILE
227+
echo "RELEASE_FILE=$FILE" >> $GITHUB_ENV
228+
echo "UPLOAD_FILES=./dist/$FILE" >> $GITHUB_ENV
229+
fi
230+
231+
- name: Upload Release Artifacts
232+
if: |
233+
(github.event_name == 'push') ||
234+
(github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true')
235+
uses: softprops/action-gh-release@v2
236+
with:
237+
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || format('v{0}', env.VERSION) }}
238+
name: ${{ github.event_name == 'workflow_dispatch' && format('Robrix {0}', github.event.inputs.release_tag) || format('Robrix v{0}', env.VERSION) }}
239+
token: ${{ secrets.ROBRIX_RELEASE }}
240+
files: ${{ env.UPLOAD_FILES }}
241+
prerelease: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pre_release == 'true' || contains(github.ref, '-') }}
242+
draft: ${{ github.event_name == 'workflow_dispatch' }}
243+
244+
- name: Upload Artifacts (No Release)
245+
if: |
246+
github.event_name == 'workflow_dispatch' && github.event.inputs.create_release != 'true'
247+
uses: actions/upload-artifact@v4
248+
with:
249+
name: robrix-${{ env.VERSION }}-${{ matrix.os }}-${{ matrix.arch }}
250+
path: ${{ env.UPLOAD_FILES }}
251+
retention-days: 30

0 commit comments

Comments
 (0)