-
Notifications
You must be signed in to change notification settings - Fork 7
191 lines (162 loc) · 6.67 KB
/
build.yaml
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
name: Publish
on:
workflow_dispatch:
inputs:
version:
description: 'Version to bump to'
required: true
type: choice
options:
- patch
- minor
- major
update_frontend:
description: 'Try to pull latest changes from frontend repository (companion branch)'
required: false
type: boolean
default: false
jobs:
update_version:
permissions:
contents: write
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.semver.outputs.semantic-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update frontend
if: ${{ inputs.update_frontend == 'true' }}
run: |
cd frontend
git pull
cd ..
- id: semver
uses: SOLIDSoftworks/semver-tags@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
tag-prefix: 'v'
incremented-value: ${{ inputs.version }}
- name: NPM-Version
uses: Reedyuk/[email protected]
with:
version: ${{ steps.semver.outputs.semantic-version }}
- name: Update cargo and tauri version
run: |
sudo apt install jq
sed -i '0,/\(version *= *\).*/s//\1"${{ steps.semver.outputs.semantic-version }}"/' src-tauri/Cargo.toml
jq '.package.version="${{ steps.semver.outputs.semantic-version }}"' src-tauri/tauri.conf.json > tauri.config.json.new && mv tauri.config.json.new src-tauri/tauri.conf.json
sed -i '/name = "music-assistant-companion"/{N;s/\(version *= *\)".*"/\1"'"${{ steps.semver.outputs.semantic-version }}"'"/;}' src-tauri/Cargo.lock
- name: Commit and push changes
run: |
git config --global user.name "Jonathan Bangert"
git config --global user.email "[email protected]"
git add -A
git commit -m "Update version to ${{ steps.semver.outputs.semantic-version }}"
git push
build:
needs: update_version
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest, macos-12]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Pull latest changes
run: |
git pull
- name: Install dependencies (Linux)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev librsvg2-dev libayatana-appindicator3-dev
- name: Install Rust (Stable)
run:
curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Install Rust aarch (Mac)
if: matrix.platform == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
cache-on-failure: true
- name: Sync node version and setup cache
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'yarn' # Set this to npm, yarn or pnpm.
- name: Install frontend dependencies
if: matrix.platform != 'windows-latest'
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
run: yarn install && cd $GITHUB_WORKSPACE/frontend/ && yarn install && cd $GITHUB_WORKSPACE # Change this to npm, yarn or pnpm.
- name: Install frontend dependencies (Windows)
if: matrix.platform == 'windows-latest'
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
run: yarn install && cd $env:GITHUB_WORKSPACE/frontend/ && yarn install && cd $env:GITHUB_WORKSPACE # Change this to npm, yarn or pnpm.
- name: Build the app (Linux)
if: matrix.platform == 'ubuntu-20.04'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
tagName: v${{ needs.update_version.outputs.version }}
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}"
releaseBody: "Fixes"
- name: Build the app (Windows)
if: matrix.platform == 'windows-latest'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
tagName: v${{ needs.update_version.outputs.version }}
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}"
releaseBody: "Fixes"
- name: Build the app (Mac (Apple Silicon))
if: matrix.platform == 'macos-latest'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
args: --target aarch64-apple-darwin
tagName: v${{ needs.update_version.outputs.version }}
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}"
releaseBody: "Fixes"
- name: Build the app (Mac)
if: matrix.platform == 'macos-12'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
tagName: v${{ needs.update_version.outputs.version }}
releaseName: "Music Assistant Companion App ${{ needs.update_version.outputs.version }}"
releaseBody: "Fixes"
- name: Upload linux binary
if: matrix.platform == 'ubuntu-20.04'
uses: svenstaro/upload-release-action@v2
with:
tag: v${{ needs.update_version.outputs.version }}
asset_name: music-assistant-companion-${{ needs.update_version.outputs.version }}
file: src-tauri/target/release/music-assistant-companion
- name: Upload squeezelite binary
if: matrix.platform == 'ubuntu-20.04'
uses: svenstaro/upload-release-action@v2
with:
tag: v${{ needs.update_version.outputs.version }}
file: src-tauri/binaries/squeezelite-x86_64-unknown-linux-gnu