-
-
Notifications
You must be signed in to change notification settings - Fork 45
166 lines (138 loc) · 4.96 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
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
name: Build/release
on:
push:
tags:
- '*'
branches:
- 'dev'
- 'main'
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-20.04]
env:
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: '21'
cache: 'yarn'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Electron
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.cache/electron
key: ${{ runner.os }}-electron-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-electron-cache-
- name: Cache Electron-Builder
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.cache/electron-builder
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-electron-builder-cache-
- uses: Swatinem/rust-cache@v2
with:
workspaces: node_modules/librespot-node/native
- uses: maxim-lobanov/setup-xcode@v1
if: ${{ runner.os == 'macOS' }}
with:
xcode-version: latest-stable
- if: ${{ runner.os == 'Linux' }}
run: sudo apt-get update -y && sudo apt-get install -y libarchive-tools rpm libasound2-dev libssl-dev libatomic1
- name: Remove postinstall
run: |
sed -i -e 's/\"postinstall\":.*/\"postinstall\": \"patch-package\",/' package.json
shell: bash
- name: Set dev version
if: startsWith(github.ref, 'refs/heads/')
run: |
version=$(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/')
sed -i -e "s/\"version\":.*/\"version\":\"${version:1}\",/" package.json
shell: bash
- name: yarn install
run: yarn install --immutable
- name: Set env BRANCH
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Set DEBUG_LOGGING
shell: bash
run: |
if [[ $BRANCH == 'dev' ]]; then
echo "DEBUG_LOGGING=true" >> "$GITHUB_ENV"
fi
- name: setup env
env:
YOUTUBECLIENTID: '${{ secrets.YOUTUBECLIENTID }}'
YOUTUBECLIENTSECRET: '${{ secrets.YOUTUBECLIENTSECRET }}'
LASTFMAPIKEY: '${{ secrets.LASTFMAPIKEY }}'
LASTFMSECRET: '${{ secrets.LASTFMSECRET }}'
SPOTIFYCLIENTID: '${{ secrets.SPOTIFYCLIENTID }}'
SPOTIFYCLIENTSECRET: '${{ secrets.SPOTIFYCLIENTSECRET }}'
FANARTTVAPIKEY: '${{ secrets.FANARTTVAPIKEY }}'
run: chmod +x setup_env.sh && . setup_env.sh
shell: bash
# - run: yarn test:unit
# - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test:electron
# if: matrix.os == 'ubuntu-latest'
# - run: yarn test:electron
# if: matrix.os != 'ubuntu-latest'
- name: yarn electron:build
run: yarn electron:build
if: ${{ runner.os == 'Windows' }}
env:
CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: true
- name: yarn electron:build
run: yarn electron:build
if: ${{ runner.os != 'Windows' }}
env:
CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: true
- uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Windows' }}
with:
name: Windows Exe
path: |
dist_electron/*.exe
dist_electron/latest*.yml
- uses: actions/upload-artifact@v3
if: ${{ runner.os == 'macOS' }}
with:
name: MacOS Dmg
path: |
dist_electron/*.dmg
dist_electron/latest*.yml
- uses: actions/upload-artifact@v3
with:
name: Linux AppImage
path: |
dist_electron/*.AppImage
dist_electron/latest*.yml
- uses: actions/upload-artifact@v3
with:
name: Arch linux Pacman
path: |
dist_electron/*.pacman
- uses: actions/upload-artifact@v3
with:
name: Linux tar.gz
path: dist_electron/*.tar.gz
- uses: actions/upload-artifact@v3
with:
name: Linux Deb
path: dist_electron/*.deb