-
Notifications
You must be signed in to change notification settings - Fork 4
214 lines (183 loc) · 9.88 KB
/
build.yml
File metadata and controls
214 lines (183 loc) · 9.88 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
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache node_modules
id: node-modules-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: npm install
- name: Install Snapcraft
if: steps.snapcraft-cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
sudo snap install snapcraft --classic
- name: Add tar and snap to PATH and install libarchive-tools
if: runner.os == 'Linux'
run: echo "$(dirname "$(which tar)")" >> $GITHUB_PATH && echo "/snap/bin" >> $GITHUB_PATH && sudo apt-get install -y libarchive-tools
- name: Cache Electron binaries
id: electron-cache
uses: actions/cache@v3
with:
path: |
~/.cache/electron
~/.cache/electron-builder
~/AppData/Local/electron
~/AppData/Local/electron-builder
key: ${{ runner.os }}-electron-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-electron-
- name: Run build script for installers
run: npx yarn dist -- --url ${{ secrets.SITE_URL }}
- name: Run build script for portable
if: runner.os == 'Windows'
run: npx yarn dist -- --url ${{ secrets.SITE_URL }} --portable
- name: Upload build artifacts to server
if: contains(github.event.head_commit.message, '[release]')
run: node scripts/uploader.js --dir=dist
env:
UPLOAD_URL: ${{ secrets.SITE_URL }}
UPLOAD_API_KEY: ${{ secrets.UPLOAD_API_KEY }}
- name: Upload .exe files
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Windows Installer Files
path: dist/*.exe
- name: Upload Windows .zip files
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Windows Portable Files
path: dist/*.zip
- name: Upload .app files
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: macOS Portable Files
path: dist/*.zip
- name: Upload .snap files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Linux Snap Files
path: dist/*.snap
- name: Upload .deb files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Linux deb Files
path: dist/*.deb
- name: Upload .rpm files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Linux rpm Files
path: dist/*.rpm
- name: Upload .pacman files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Linux pacman Files
path: dist/*.pacman
- name: Upload .AppImage files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Linux AppImage Files
path: dist/*.AppImage
- name: Upload Linux .zip files
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: Linux Portable Files
path: dist/linux-unpacked
- name: Get package version
if: runner.os == 'Linux' && contains(github.event.head_commit.message, '[release]')
id: package-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download Windows artifacts
if: runner.os == 'Linux' && contains(github.event.head_commit.message, '[release]')
uses: actions/download-artifact@v4
with:
name: Windows Installer Files
path: release-files/
- name: Download Windows portable artifacts
if: runner.os == 'Linux' && contains(github.event.head_commit.message, '[release]')
uses: actions/download-artifact@v4
with:
name: Windows Portable Files
path: release-files/
- name: Download macOS artifacts
if: runner.os == 'Linux' && contains(github.event.head_commit.message, '[release]')
uses: actions/download-artifact@v4
with:
name: macOS Portable Files
path: release-files/
- name: Update version on server
if: runner.os == 'Linux' && contains(github.event.head_commit.message, '[release]')
run: |
curl -X POST "${{ secrets.SITE_URL }}/update/upload.php" \
-F "api_key=${{ secrets.UPLOAD_API_KEY }}" \
-F "request_type=update_version" \
-F "version=${{ steps.package-version.outputs.version }}"
env:
UPLOAD_URL: ${{ secrets.SITE_URL }}
UPLOAD_API_KEY: ${{ secrets.UPLOAD_API_KEY }}
- name: Create GitHub Release
if: runner.os == 'Linux' && contains(github.event.head_commit.message, '[release]')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.package-version.outputs.version }}
name: Sploder Launcher v${{ steps.package-version.outputs.version }}
body: |
**Windows Builds:**
- [Sploder-Setup-${{ steps.package-version.outputs.version }}.exe](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-Setup-${{ steps.package-version.outputs.version }}.exe) - Universal build for Windows, requires administrator privileges
- [Sploder-Setup-${{ steps.package-version.outputs.version }}-ia32.exe](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-Setup-${{ steps.package-version.outputs.version }}-ia32.exe) - 32-bit build for Windows, requires administrator privileges
- [Sploder-Setup-${{ steps.package-version.outputs.version }}-x64.exe](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-Setup-${{ steps.package-version.outputs.version }}-x64.exe) - 64-bit build for Windows, requires administrator privileges
- [Sploder-Portable-${{ steps.package-version.outputs.version }}-ia32.zip](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-Portable-${{ steps.package-version.outputs.version }}-ia32.zip) - 32-bit portable build for Windows, no administrator privileges needed
- [Sploder-Portable-${{ steps.package-version.outputs.version }}-x64.zip](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-Portable-${{ steps.package-version.outputs.version }}-x64.zip) - 64-bit portable build for Windows, no administrator privileges needed
**macOS Builds:**
- [Sploder-macOS-${{ steps.package-version.outputs.version }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-macOS-${{ steps.package-version.outputs.version }}.zip) - macOS build
**Linux Builds:**
- [Sploder_${{ steps.package-version.outputs.version }}_amd64.snap](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder_${{ steps.package-version.outputs.version }}_amd64.snap) - Snap package for Linux
- [Sploder_${{ steps.package-version.outputs.version }}_amd64.deb](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder_${{ steps.package-version.outputs.version }}_amd64.deb) - Debian package for Linux
- [Sploder-${{ steps.package-version.outputs.version }}.x86_64.rpm](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-${{ steps.package-version.outputs.version }}.x86_64.rpm) - RPM package for Linux
- [Sploder-${{ steps.package-version.outputs.version }}.pacman](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-${{ steps.package-version.outputs.version }}.pacman) - Pacman package for Linux
- [Sploder-${{ steps.package-version.outputs.version }}.AppImage](https://github.com/${{ github.repository }}/releases/download/${{ steps.package-version.outputs.version }}/Sploder-${{ steps.package-version.outputs.version }}.AppImage) - AppImage for Linux
files: |
release-files/*
dist/*.snap
dist/*.deb
dist/*.rpm
dist/*.pacman
dist/*.AppImage
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}