-
-
Notifications
You must be signed in to change notification settings - Fork 11
176 lines (153 loc) · 6.78 KB
/
release.yml
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: Build and Release
on:
workflow_dispatch:
env:
VERSION: 2.0.0
jobs:
# Release build job
release:
permissions: write-all
strategy:
fail-fast: false
matrix:
platform:
[macos-latest, macos-13, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl libssl-dev libx11-dev libxi-dev libxtst-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Install app dependencies
run: cargo install cargo-packager --locked
- name: Package Binary
run: cargo packager --release --verbose
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-release-artifacts
path: |
${{ matrix.platform == 'macos-latest' && 'target/release/Raspirus.app' || '' }}
${{ matrix.platform == 'macos-latest' && 'target/release/Raspirus_*_aarch64.dmg' || '' }}
${{ matrix.platform == 'macos-13' && 'target/release/Raspirus.app' || '' }}
${{ matrix.platform == 'macos-13' && 'target/release/Raspirus_*_x64.dmg' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/PKGBUILD' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/raspirus_*_amd64.deb' || '' }}
${{ matrix.platform == 'ubuntu-latest' && 'target/release/raspirus_*_x86_64.AppImage' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/raspirus_*_x64_en-US.msi' || '' }}
${{ matrix.platform == 'windows-latest' && 'target/release/raspirus_*_x64-setup.exe' || '' }}
# Cross-compilation job
cross_compile:
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
target: aarch64-unknown-linux-gnu
apt: gcc-aarch64-linux-gnu
sysroot: /usr/aarch64-linux-gnu/
pkg_arch: arm64
- arch: riscv64
target: riscv64gc-unknown-linux-gnu
apt: gcc-riscv64-linux-gnu
sysroot: /usr/riscv64-linux-gnu/
pkg_arch: riscv64
# UNSUPPORTED with iced :(
# - arch: armv7
# target: armv7-unknown-linux-gnueabihf
# apt: gcc-arm-linux-gnueabihf
# sysroot: /usr/arm-linux-gnueabihf/
# pkg_arch: armhf
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clean install Debian packages
run: sudo apt-get clean && sudo apt-get update && sudo apt-get upgrade -y
- name: Install cross-compile dependencies
uses: ryankurte/[email protected]
with:
arch: ${{ matrix.pkg_arch }}
packages: "libssl-dev:${{ matrix.pkg_arch }}"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libx11-dev \
libxi-dev \
libxtst-dev \
build-essential \
curl \
libssl-dev \
${{ matrix.apt }}
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- name: Set environment variables
run: echo "PKG_CONFIG_SYSROOT_DIR=${{ matrix.sysroot }}" >> $GITHUB_ENV
- name: Install deb packager
run: cargo install cargo-deb
- name: Package the cross-compiled build
env:
PKG_CONFIG_SYSROOT_DIR: ${{ matrix.sysroot }}
run: |
cargo deb --target=${{ matrix.target }}
- name: Upload cross-compile artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pkg_arch }}-cross-compile-artifacts
path: target/${{ matrix.target }}/debian/*.deb
# Upload to GitHub release job
upload_to_release:
permissions: write-all
runs-on: ubuntu-latest
needs: [release, cross_compile]
steps:
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create attestation for all builds
uses: actions/attest-build-provenance@v1
with:
subject-path: |
artifacts/PKGBUILD
artifacts/Raspirus_*_aarch64.dmg
artifacts/Raspirus_*_x64.dmg
artifacts/raspirus_*_amd64.deb
artifacts/raspirus_*_x86_64.AppImage
artifacts/raspirus_*_x64_en-US.msi
artifacts/raspirus_*_x64-setup.exe
artifacts/raspirus_*_arm64.deb
artifacts/raspirus_*_riscv64.deb
# target/armv7-unknown-linux-gnueabihf/debian/*.deb
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: Raspirus v${{ env.VERSION }}
files: |
artifacts/PKGBUILD
artifacts/Raspirus_*_aarch64.dmg
artifacts/Raspirus_*_x64.dmg
artifacts/raspirus_*_amd64.deb
artifacts/raspirus_*_x86_64.AppImage
artifacts/raspirus_*_x64_en-US.msi
artifacts/raspirus_*_x64-setup.exe
artifacts/raspirus_*_arm64.deb
artifacts/raspirus_*_riscv64.deb
# target/armv7-unknown-linux-gnueabihf/debian/*.deb