-
Notifications
You must be signed in to change notification settings - Fork 116
196 lines (195 loc) · 7.8 KB
/
release.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
192
193
194
195
196
name: release
on:
push:
tags:
- v*.*.*
workflow_dispatch:
inputs:
tag_name:
description: "Tag to release"
required: true
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [x64, arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: corepack enable
- run: yarn
- if: matrix.architecture == 'x64'
run: yarn make --arch=x64 --verbose
- if: matrix.architecture == 'arm64'
run: yarn make --arch=arm64 --verbose
- id: find_assets_rpm
run: |
ASSET_PATH=$(find ./out/make -path './node_modules' -prune -o -name '*.rpm' -print | head -n 1)
ABSOLUTE_ASSET_PATH=$(realpath "$ASSET_PATH")
echo "ASSET_RPM_PATH=$ABSOLUTE_ASSET_PATH" >> $GITHUB_ENV
BASENAME=$(basename "$ASSET_PATH")
echo "ASSET_RPM_BASENAME=$BASENAME" >> $GITHUB_ENV
shell: bash
- id: find_assets_deb
run: |
ASSET_PATH=$(find ./out/make -path './node_modules' -prune -o -name '*.deb' -print | head -n 1)
ABSOLUTE_ASSET_PATH=$(realpath "$ASSET_PATH")
echo "ASSET_DEB_PATH=$ABSOLUTE_ASSET_PATH" >> $GITHUB_ENV
BASENAME=$(basename "$ASSET_PATH")
echo "ASSET_DEB_BASENAME=$BASENAME" >> $GITHUB_ENV
shell: bash
- id: upload-artifact-rpm
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_RPM_BASENAME }}
path: ${{ env.ASSET_RPM_PATH }}
overwrite: true
- id: upload-artifact-deb
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_DEB_BASENAME }}
path: ${{ env.ASSET_DEB_PATH }}
overwrite: true
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: ${{ env.ASSET_RPM_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: ${{ env.ASSET_DEB_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}
macos:
runs-on: macos-latest
strategy:
matrix:
architecture: [x64, arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: python --version
- run: corepack enable
- run: corepack prepare yarn
- run: yarn
- if: matrix.architecture == 'x64'
run: yarn make --arch=x64 --verbose
- if: matrix.architecture == 'arm64'
run: yarn make --arch=arm64 --verbose
- id: find_asset
run: |
ASSET_PATH=$(find ./out/make -path './node_modules' -prune -o -name '*.dmg' -print | head -n 1)
ABSOLUTE_ASSET_PATH=$(realpath "$ASSET_PATH")
echo "ASSET_PATH=$ABSOLUTE_ASSET_PATH" >> $GITHUB_ENV
BASENAME=$(basename "$ASSET_PATH")
echo "ASSET_BASENAME=$BASENAME" >> $GITHUB_ENV
shell: bash
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_BASENAME }}
path: ${{ env.ASSET_PATH }}
overwrite: true
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: ${{ env.ASSET_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}
windows:
runs-on: windows-latest
strategy:
matrix:
architecture: [x64, arm64, i386]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: python --version
- run: corepack enable
- shell: pwsh
run: |
$retries = 1
$count = 0
do {
yarn
$exitCode = $?
if ($exitCode -eq 0) {
break
}
$count++
Write-Output "Retrying ($count/$retries)..."
Start-Sleep -Seconds 5
} while ($count -lt $retries)
- if: matrix.architecture == 'x64'
run: yarn make --arch=x64 --verbose
- if: matrix.architecture == 'arm64'
run: yarn make --arch=arm64 --verbose
- if: matrix.architecture == 'i386'
run: yarn make --arch=ia32 --verbose
- if: matrix.architecture == 'arm64'
id: find_asset_arm64
run: |
$assetPath = (Get-ChildItem -Path out/make -Recurse -Filter *.exe | Select-Object -First 1).FullName
$basename = [System.IO.Path]::GetFileNameWithoutExtension($assetPath)
$extension = [System.IO.Path]::GetExtension($assetPath)
$newBasename = ($basename -replace ' ', '-') + "-arm64" + $extension
$newFilePath = (Join-Path -Path (Get-Item $assetPath).DirectoryName -ChildPath $newBasename)
Rename-Item -Path $assetPath -NewName $newBasename
$escapedFilePath = $newFilePath -replace '\\', '\\\\'
echo "ASSET_BASENAME=$newBasename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "ASSET_PATH=$escapedFilePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- if: matrix.architecture == 'x64'
id: find_asset_x64
run: |
$assetPath = (Get-ChildItem -Path out/make -Recurse -Filter *.exe | Select-Object -First 1).FullName
$basename = [System.IO.Path]::GetFileNameWithoutExtension($assetPath)
$extension = [System.IO.Path]::GetExtension($assetPath)
$newBasename = ($basename -replace ' ', '-') + "-x64" + $extension
$newFilePath = (Join-Path -Path (Get-Item $assetPath).DirectoryName -ChildPath $newBasename)
Rename-Item -Path $assetPath -NewName $newBasename
$escapedFilePath = $newFilePath -replace '\\', '\\\\'
echo "ASSET_BASENAME=$newBasename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "ASSET_PATH=$escapedFilePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- if: matrix.architecture == 'i386'
id: find_asset_x86
run: |
$assetPath = (Get-ChildItem -Path out/make -Recurse -Filter *.exe | Select-Object -First 1).FullName
$basename = [System.IO.Path]::GetFileNameWithoutExtension($assetPath)
$extension = [System.IO.Path]::GetExtension($assetPath)
$newBasename = ($basename -replace ' ', '-') + "-x86" + $extension
$newFilePath = (Join-Path -Path (Get-Item $assetPath).DirectoryName -ChildPath $newBasename)
Rename-Item -Path $assetPath -NewName $newBasename
$escapedFilePath = $newFilePath -replace '\\', '\\\\'
echo "ASSET_BASENAME=$newBasename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "ASSET_PATH=$escapedFilePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET_BASENAME }}
path: ${{ env.ASSET_PATH }}
overwrite: true
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: ${{ env.ASSET_PATH }}
token: ${{ secrets.GITHUB_TOKEN }}