-
Notifications
You must be signed in to change notification settings - Fork 218
139 lines (124 loc) · 4.35 KB
/
build.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
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macOS-latest
target: x86_64-apple-darwin
- os: macOS-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build and Upload Binary
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: psst-gui
target: ${{ matrix.target }}
archive: psst-${{ matrix.target }}
tar: unix
zip: windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
- name: Create Universal Binary (macOS)
if: matrix.os == 'macOS-latest' && matrix.target == 'x86_64-apple-darwin'
run: |
lipo -create -output psst-gui-universal \
../target/x86_64-apple-darwin/release/psst-gui \
../target/aarch64-apple-darwin/release/psst-gui
- name: Create DMG (macOS)
if: matrix.os == 'macOS-latest' && matrix.target == 'x86_64-apple-darwin'
run: |
brew install create-dmg
mkdir -p Psst.app/Contents/MacOS
cp psst-gui-universal Psst.app/Contents/MacOS/psst-gui
cp assets/logo.icns Psst.app/Contents/Resources/
create-dmg \
--volname "Psst" \
--volicon "assets/logo.icns" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "Psst.app" 150 160 \
--hide-extension "Psst.app" \
--app-drop-link 450 160 \
--no-internet-enable \
"Psst.dmg" \
"Psst.app"
- name: Upload DMG
if: matrix.os == 'macOS-latest' && matrix.target == 'x86_64-apple-darwin'
uses: actions/upload-artifact@v4
with:
name: Psst.dmg
path: Psst.dmg
deb:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: amd64
target: x86_64-unknown-linux-gnu
- arch: arm64
target: aarch64-unknown-linux-gnu
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Linux Binary
uses: actions/download-artifact@v4
with:
name: psst-${{ matrix.target }}
path: ${{runner.workspace}}/binaries
- name: Extract Binary
run: |
tar -xvf ${{runner.workspace}}/binaries/psst-${{ matrix.target }}.tar.gz -C ${{runner.workspace}}/binaries
mkdir -p ${{runner.workspace}}/pkg/usr/bin/
mv ${{runner.workspace}}/binaries/psst-gui ${{runner.workspace}}/pkg/usr/bin/
- name: Add Metadata and Icons
run: |
mkdir -p ${{runner.workspace}}/pkg/usr/share/applications/
cp .pkg/psst.desktop $_
mkdir -p ${{runner.workspace}}/pkg/usr/share/icons/hicolor/
cp -r psst-gui/assets/logo_*.png $_
cp psst-gui/assets/logo.svg ${{runner.workspace}}/pkg/usr/share/icons/hicolor/scalable/apps/psst.svg
- name: Create Debian Package
run: |
mkdir -p ${{runner.workspace}}/pkg/DEBIAN
cat << EOF > ${{runner.workspace}}/pkg/DEBIAN/control
Package: psst
Version: $(git rev-list --count HEAD)
Architecture: ${{ matrix.arch }}
Maintainer: Jan Pochyla <jpochyla@gmail.com>
Description: Fast Spotify client with native GUI
Small and efficient graphical music player for Spotify network.
EOF
dpkg-deb -b ${{runner.workspace}}/pkg psst_$(git rev-list --count HEAD)_${{ matrix.arch }}.deb
- name: Upload Debian Package
uses: actions/upload-artifact@v4
with:
name: psst-deb-${{ matrix.arch }}
path: "*.deb"