-
-
Notifications
You must be signed in to change notification settings - Fork 26
178 lines (155 loc) · 6.8 KB
/
release.yml
File metadata and controls
178 lines (155 loc) · 6.8 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
name: Build/release Electron app
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ${{ matrix.os }}
env:
EP_DRAFT: 'true'
strategy:
matrix:
include:
- os: macos-latest
platform: mac
arch: arm64
- os: macos-15-intel
platform: mac
arch: x64
- os: ubuntu-latest
platform: linux
arch: x64
- os: ubuntu-24.04-arm
platform: linux
arch: arm64
- os: windows-latest
platform: windows
arch: x64
- os: windows-11-arm
platform: windows
arch: arm64
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install system FPM (Linux ARM64)
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Set version from tag
shell: bash
run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Run Electron Builder (Windows)
if: matrix.platform == 'windows'
run: npx electron-builder --windows --${{ matrix.arch }} --publish never
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Run Electron Builder (Linux x64)
if: matrix.platform == 'linux' && matrix.arch == 'x64'
run: npx electron-builder --linux deb tar.gz rpm --x64 --publish always
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Run Electron Builder (Linux ARM64)
if: matrix.platform == 'linux' && matrix.arch == 'arm64'
run: npx electron-builder --linux deb tar.gz rpm --arm64 --publish always
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
USE_SYSTEM_FPM: 'true'
- name: Run Electron Builder (macOS)
if: matrix.platform == 'mac'
run: |
echo "$API_KEY" > apple.p8
npx electron-builder --mac --${{ matrix.arch }} --publish never
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CSC_LINK: ${{ secrets.MAC_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTS_PASSWORD }}
API_KEY: ${{ secrets.API_KEY }}
APPLE_API_KEY: apple.p8
APPLE_API_KEY_ID: ${{ secrets.API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.API_KEY_ISSUER_ID }}
- name: Upload release artifacts
if: matrix.platform == 'mac' || matrix.platform == 'windows'
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.platform }}-${{ matrix.arch }}
path: |
dist/*.dmg
dist/*-mac.zip
dist/*.exe
dist/*.blockmap
dist/latest-*.yml
dist/latest-mac.yml
dist/latest.yml
if-no-files-found: ignore
merge-update-ymls:
needs: release
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install yaml package
run: npm install --no-save --ignore-scripts yaml
- name: Download all release artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
pattern: release-*
- name: List downloaded artifacts
run: find release-artifacts -type f | sort
- name: Merge macOS update yml files
run: |
MAC_YMLS=$(find release-artifacts -name 'latest-*-mac.yml' | sort)
MAC_COUNT=$(echo "$MAC_YMLS" | wc -l)
if [ "$MAC_COUNT" -ge 2 ]; then
echo "Merging $MAC_COUNT latest-mac.yml files"
node scripts/merge-update-ymls.js --prefer-arch arm64 merged-latest-mac.yml $MAC_YMLS
else
echo "Only one latest-mac.yml found, copying as-is"
cp $(echo "$MAC_YMLS" | head -1) merged-latest-mac.yml
fi
- name: Merge Windows update yml files
run: |
WIN_YMLS=$(find release-artifacts -name 'latest-*.yml' ! -name 'latest-*-mac.yml' | sort)
WIN_COUNT=$(echo "$WIN_YMLS" | wc -l)
if [ "$WIN_COUNT" -ge 2 ]; then
echo "Merging $WIN_COUNT latest.yml files"
node scripts/merge-update-ymls.js --prefer-arch x64 merged-latest.yml $WIN_YMLS
else
echo "Only one latest.yml found, copying as-is"
cp $(echo "$WIN_YMLS" | head -1) merged-latest.yml
fi
- name: Get release tag
id: tag
run: echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Upload merged yml files to release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
TAG="${{ steps.tag.outputs.tag }}"
find release-artifacts -type f \( -name '*.dmg' -o -name '*-mac.zip' -o -name '*.exe' -o -name '*.blockmap' \) -print0 | \
xargs -0 -r gh release upload "$TAG" --clobber
find release-artifacts -type f \( -name 'latest-*-mac.yml' -o -name 'latest-*.yml' \) -print0 | \
xargs -0 -r gh release upload "$TAG" --clobber
for FILE in merged-latest-mac.yml merged-latest.yml; do
if [ -f "$FILE" ]; then
ASSET_NAME="${FILE#merged-}"
mv "$FILE" "$ASSET_NAME"
echo "Uploading $ASSET_NAME to release $TAG"
gh release upload "$TAG" "$ASSET_NAME" --clobber
fi
done