-
Notifications
You must be signed in to change notification settings - Fork 17
256 lines (223 loc) · 7.82 KB
/
Copy pathrelease.yml
File metadata and controls
256 lines (223 loc) · 7.82 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
248
249
250
251
252
253
254
255
256
# Copyright 2021- Dotan Nahum
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file is modified by Mrmayman, ApicalShark on 2024
name: Release
permissions:
contents: write
on:
workflow_dispatch: # allows manual triggering
# schedule:
# - cron: '0 0 * * *' # midnight UTC
push:
tags:
- "v[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
## - release
env:
BIN_NAME: quantum_launcher
PROJECT_NAME: quantum_launcher
REPO_NAME: Mrmayman/quantum-launcher
CARGO_TERM_COLOR: always # Tell cargo to always use colors
jobs:
dist:
name: Dist
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't fail other jobs if one fails
matrix:
build: [x86_64-linux, aarch64-linux, armv7-linux, x86_64-macos, x86_64-windows, aarch64-macos, aarch64-windows, i686-windows]
include:
- build: x86_64-linux
os: ubuntu-22.04
rust: stable
target: x86_64-unknown-linux-gnu
cross: false
final_name: linux_x86_64
- build: aarch64-linux
os: ubuntu-22.04-arm
rust: stable
target: aarch64-unknown-linux-gnu
cross: false
final_name: linux_aarch64
- build: armv7-linux
os: ubuntu-22.04
rust: stable
target: armv7-unknown-linux-gnueabihf
cross: true
final_name: linux_arm32
- build: x86_64-macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
cross: false
final_name: macos_x86_64
- build: x86_64-windows
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
cross: false
final_name: windows_x86_64
- build: aarch64-macos
os: macos-latest
rust: stable
target: aarch64-apple-darwin
cross: false
final_name: macos_aarch64
- build: aarch64-windows
os: windows-11-arm
rust: stable
target: aarch64-pc-windows-msvc
cross: false
final_name: windows_aarch64
- build: i686-windows
os: ubuntu-latest
rust: stable
target: i686-pc-windows-gnu
cross: true
final_name: windows_i686
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-22.04-arm'
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config libdbus-1-3
- uses: ilammy/setup-nasm@v1
- name: Install rustup for ${{ matrix.os }}
if: matrix.os == 'windows-11-arm'
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs/aarch64 -o rustup-init.exe
./rustup-init.exe -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install ${{ matrix.rust }} toolchain
shell: bash
run: |
rustup toolchain install ${{ matrix.rust }} --no-self-update
rustup default ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
if [ "${{ matrix.cross }}" == "true" ]; then
cargo install cross --locked
fi
- name: Build release binary
shell: bash
run: |
if [ "${{ matrix.cross }}" == "true" ]; then
cross build --profile release-ql --target ${{ matrix.target }}
else
cargo build --profile release-ql --target ${{ matrix.target }}
fi
- name: Build archive
shell: bash
run: |
mkdir dist
if [ "${{ matrix.build }}" = "x86_64-windows" ] || [ "${{ matrix.build }}" = "i686-windows" ]; then
cp "target/${{ matrix.target }}/release-ql/$BIN_NAME.exe" "dist/"
elif [ "${{ matrix.build }}" = "aarch64-macos" ] || [ "${{ matrix.build }}" = "x86_64-macos" ]; then
APP_DIR="build/quantum-launcher.app"
MACOS_DIR="$APP_DIR/Contents/MacOS"
RESOURCES_DIR="$APP_DIR/Contents/Resources"
mkdir -p "$MACOS_DIR" "$RESOURCES_DIR"
cp "target/${{ matrix.target }}/release-ql/$BIN_NAME" "$MACOS_DIR/$BIN_NAME"
cp assets/freedesktop/Info.plist "$APP_DIR/Contents/Info.plist"
sips -s format icns "assets/icon/ql_logo.png" --out "$RESOURCES_DIR/ql_logo.icns"
hdiutil create -volname "${{ env.BIN_NAME}}" -srcfolder "$APP_DIR" -ov -format UDZO "dist/${{ env.BIN_NAME }}.dmg"
else
cp "target/${{ matrix.target }}/release-ql/$BIN_NAME" "dist/"
fi
- uses: actions/upload-artifact@v4
with:
name: quantum-launcher-${{ matrix.final_name }}
path: dist
publish:
name: Publish
needs: [dist]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: false
- uses: actions/download-artifact@v4
- run: ls -al quantum-launcher-*
- name: Calculate tag name
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
name=${GITHUB_REF:10}
fi
echo val=$name >> $GITHUB_OUTPUT
echo TAG=$name >> $GITHUB_ENV
id: tagname
- name: Build archive and Copy binaries
shell: bash
run: |
set -ex
rm -rf tmp
mkdir tmp
mkdir dist
mkdir arti # Create the 'arti' directory
echo "Listing dirs: "
ls
echo "...Done."
for dir in quantum-launcher-* ; do
platform=${dir#"quantum-launcher-"}
unset exe
if [[ $platform =~ "windows" ]]; then
exe=".exe"
else
exe=""
fi
unset dmg
if [[ $platform =~ "macos" ]]; then
dmg=".dmg"
else
dmg=""
fi
# Change PROJECT_NAME to BIN_NAME if you wish
pkgname=${PROJECT_NAME}_${platform}
echo "Package name: $pkgname"
binary_path=$dir/$BIN_NAME$exe$flatpak$dmg
if [ ! -f "$binary_path" ]; then
echo "Error: Binary not found at $binary_path. Check your setup!"
exit 1
fi
# Zip the binary with no sub dir
(zip -j "dist/$pkgname.zip" "$binary_path")
# Zip the binary to arti
(zip -j "arti/$pkgname.zip" "$binary_path")
done
- name: Upload as artifact
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
name: binaries
path: arti/* # Zip the binaries under arti folder
- name: Upload binaries to release
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/* #Release the binary under dist folder
file_glob: true
tag: ${{ steps.tagname.outputs.val }}
overwrite: true
- name: Extract version
id: extract-version
run: |
printf "%s=%s\n" >> $GITHUB_OUTPUT tag-name "${GITHUB_REF#refs/tags/}"