-
Notifications
You must be signed in to change notification settings - Fork 858
211 lines (204 loc) · 8.97 KB
/
Copy pathbuild.yml
File metadata and controls
211 lines (204 loc) · 8.97 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
name: Build
on:
workflow_dispatch:
jobs:
build-meta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Generate build metadata
run: |
VERSION=$(node -p "require('./package.json').version")
BRANCH=${GITHUB_REF_NAME}
COMMIT=${GITHUB_SHA}
echo "{\"branch\":\"${BRANCH}\",\"version\":\"${VERSION}\",\"commit\":\"${COMMIT}\"}" > build-meta.json
cat build-meta.json
- uses: actions/upload-artifact@v6
with:
name: build-meta
path: build-meta.json
retention-days: 30
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Read version
run: |
$version = node -p "require('./package.json').version"
echo "VERSION=$version" >> $env:GITHUB_ENV
- run: pnpm run package
- uses: maotoumao/inno-setup-action-cli@main
with:
filepath: ./release/build-windows.iss
variables: /DMyAppVersion=${{ env.VERSION }} /DMyAppId=${{ secrets.MYAPPID }}
- name: Rename setup file
run: |
Rename-Item -Path "./out/MusicFreeSetup.exe" -NewName "MusicFree-${{ env.VERSION }}-win32-x64-setup.exe"
- name: Generate portable
run: |
New-Item -ItemType Directory -Path "./out/MusicFree-win32-x64/portable" -Force
New-Item -ItemType File -Path "./out/MusicFree-win32-x64/portable/.portable" -Force
- name: Archive portable
run: |
Compress-Archive -Path "./out/MusicFree-win32-x64/*" -DestinationPath "./out/MusicFree-${{ env.VERSION }}-win32-x64-portable.zip"
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-win32-x64-setup
path: ./out/MusicFree-${{ env.VERSION }}-win32-x64-setup.exe
retention-days: 30
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-win32-x64-portable
path: ./out/MusicFree-${{ env.VERSION }}-win32-x64-portable.zip
retention-days: 30
build-windows-legacy:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- run: pnpm install
- name: Read version
run: |
$version = node -p "require('./package.json').version"
echo "VERSION=$version" >> $env:GITHUB_ENV
- name: Override Win7 compatibility files
run: |
Get-ChildItem -Recurse -Filter "*.win7.ts" | ForEach-Object {
$target = $_.FullName -replace '\.win7\.ts$', '.ts'
Write-Host "Overriding: $target"
Copy-Item $_.FullName $target -Force
}
- name: Install Electron 22
run: pnpm add electron@22 --save-dev
- run: pnpm run package
- uses: maotoumao/inno-setup-action-cli@main
with:
filepath: ./release/build-windows.iss
variables: /DMyAppVersion=${{ env.VERSION }} /DMyAppId=${{ secrets.MYAPPID }}
- name: Rename setup file
run: |
Rename-Item -Path "./out/MusicFreeSetup.exe" -NewName "MusicFree-${{ env.VERSION }}-win32-x64-legacy-setup.exe"
- name: Generate portable
run: |
New-Item -ItemType Directory -Path "./out/MusicFree-win32-x64/portable" -Force
New-Item -ItemType File -Path "./out/MusicFree-win32-x64/portable/.portable" -Force
- name: Archive portable
run: |
Compress-Archive -Path "./out/MusicFree-win32-x64/*" -DestinationPath "./out/MusicFree-${{ env.VERSION }}-win32-x64-legacy-portable.zip"
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-win32-x64-legacy-setup
path: ./out/MusicFree-${{ env.VERSION }}-win32-x64-legacy-setup.exe
retention-days: 30
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-win32-x64-legacy-portable
path: ./out/MusicFree-${{ env.VERSION }}-win32-x64-legacy-portable.zip
retention-days: 30
build-macos-x64:
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: Fix node-gyp for Python 3.12+
run: pip install setuptools
- run: pnpm install --frozen-lockfile
- name: Read version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- run: pnpm run make
- name: Rename DMG
run: mv "./out/make/MusicFree-${{ env.VERSION }}-x64.dmg" "./out/make/MusicFree-${{ env.VERSION }}-darwin-x64.dmg"
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-darwin-x64
path: ./out/make/MusicFree-${{ env.VERSION }}-darwin-x64.dmg
retention-days: 30
build-macos-arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: Fix node-gyp for Python 3.12+
run: pip install setuptools
- run: pnpm install --frozen-lockfile
- name: Read version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- run: pnpm run make -- --arch=arm64
- name: Rename DMG
run: mv "./out/make/MusicFree-${{ env.VERSION }}-arm64.dmg" "./out/make/MusicFree-${{ env.VERSION }}-darwin-arm64.dmg"
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-darwin-arm64
path: ./out/make/MusicFree-${{ env.VERSION }}-darwin-arm64.dmg
retention-days: 30
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y rpm
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Read version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- run: pnpm run make
- name: Rename DEB
run: |
DEB_FILE=$(find ./out/make/deb/x64/ -name "*.deb" | head -1)
if [ -n "$DEB_FILE" ]; then
mv "$DEB_FILE" "./out/make/deb/x64/MusicFree-${{ env.VERSION }}-linux-amd64.deb"
fi
- name: Rename RPM
run: |
RPM_FILE=$(find ./out/make/rpm/x64/ -name "*.rpm" | head -1)
if [ -n "$RPM_FILE" ]; then
mv "$RPM_FILE" "./out/make/rpm/x64/MusicFree-${{ env.VERSION }}-linux-amd64.rpm"
fi
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-linux-amd64-deb
path: ./out/make/deb/x64/MusicFree-${{ env.VERSION }}-linux-amd64.deb
retention-days: 30
- uses: actions/upload-artifact@v6
with:
name: MusicFree-${{ env.VERSION }}-linux-amd64-rpm
path: ./out/make/rpm/x64/MusicFree-${{ env.VERSION }}-linux-amd64.rpm
retention-days: 30