Skip to content

Commit

Permalink
chore: publish by tag event
Browse files Browse the repository at this point in the history
  • Loading branch information
yantze committed Jan 28, 2023
1 parent a52a469 commit 5cf8631
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: RELEASE
name: Pre release by tag

on:
push:
Expand Down Expand Up @@ -29,16 +29,22 @@ jobs:

- name: Package Electron
run: |
pnpm install
pnpm pack
node ./scripts/apply-product.js
echo "package.json:" && cat package.json
echo "./build/package.json" && cat ./build/package.json
pnpm i --no-frozen-lockfile
pnpm download-extension
pnpm run pack
env:
TARGET_PLATFORMS: darwin
TARGET_ARCHES: x64,arm64
PRODUCT_VERSION: ${{ github.ref_name }}

- uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: true
files: |
LICENSE
out-x64/*.dmg
out-x64/*.exe
out/LICENSE
out/*.dmg
out/*.exe
7 changes: 6 additions & 1 deletion scripts/apply-product.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ function saveProductJson() {
productJson['sumiVersion'] = String(process.env.SUMI_VERSION).trim();
}
if (process.env.PRODUCT_VERSION) {
productJson['version'] = String(process.env.PRODUCT_VERSION).trim();
let _version = String(process.env.PRODUCT_VERSION).trim();
if (_version.startsWith('v')) {
// transform tag version eg. v1.3.6 to 1.3.6
_version = _version.substring(1);
}
productJson['version'] = _version;
}
const jsonPath = path.join(__dirname, '../product.json');
saveWithPrettier(jsonPath, productJson);
Expand Down

0 comments on commit 5cf8631

Please sign in to comment.