Skip to content

Commit 5cf8631

Browse files
committed
chore: publish by tag event
1 parent a52a469 commit 5cf8631

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: RELEASE
1+
name: Pre release by tag
22

33
on:
44
push:
@@ -29,16 +29,22 @@ jobs:
2929

3030
- name: Package Electron
3131
run: |
32-
pnpm install
33-
pnpm pack
32+
node ./scripts/apply-product.js
33+
echo "package.json:" && cat package.json
34+
echo "./build/package.json" && cat ./build/package.json
35+
pnpm i --no-frozen-lockfile
36+
pnpm download-extension
37+
pnpm run pack
3438
env:
3539
TARGET_PLATFORMS: darwin
40+
TARGET_ARCHES: x64,arm64
41+
PRODUCT_VERSION: ${{ github.ref_name }}
3642

3743
- uses: 'marvinpinto/action-automatic-releases@latest'
3844
with:
3945
repo_token: '${{ secrets.GITHUB_TOKEN }}'
4046
prerelease: true
4147
files: |
42-
LICENSE
43-
out-x64/*.dmg
44-
out-x64/*.exe
48+
out/LICENSE
49+
out/*.dmg
50+
out/*.exe

scripts/apply-product.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ function saveProductJson() {
2828
productJson['sumiVersion'] = String(process.env.SUMI_VERSION).trim();
2929
}
3030
if (process.env.PRODUCT_VERSION) {
31-
productJson['version'] = String(process.env.PRODUCT_VERSION).trim();
31+
let _version = String(process.env.PRODUCT_VERSION).trim();
32+
if (_version.startsWith('v')) {
33+
// transform tag version eg. v1.3.6 to 1.3.6
34+
_version = _version.substring(1);
35+
}
36+
productJson['version'] = _version;
3237
}
3338
const jsonPath = path.join(__dirname, '../product.json');
3439
saveWithPrettier(jsonPath, productJson);

0 commit comments

Comments
 (0)