Skip to content

Commit 798fb66

Browse files
committed
chore(build): added pr version on app version
1 parent d42c55e commit 798fb66

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/build-dev.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ jobs:
4141
- name: Enable code signing only for current repo
4242
if: github.event.pull_request.head.repo.full_name == github.repository
4343
run: echo "CSC_FOR_PULL_REQUEST=true" >> $GITHUB_ENV
44+
45+
- name: Set dev version
46+
run: |
47+
echo "Creating patch-version.js"
48+
cat << 'EOF' > patch-version.js
49+
const fs = require('fs');
50+
const pkg = require('./package.json');
51+
const sha = process.env.COMMIT_SHA.slice(0, 7);
52+
const pr = process.env.PR_NUMBER;
53+
const baseVersion = pkg.version.replace(/-dev.*$/, '');
54+
pkg.version = `${baseVersion}-dev.pr${pr}.${sha}`;
55+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
56+
console.log("Updated version:", pkg.version);
57+
EOF
58+
node patch-version.js
59+
shell: bash
60+
env:
61+
GITHUB_SHA: ${{ github.sha }}
62+
PR_NUMBER: ${{ github.event.pull_request.number }}
63+
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
4464

4565
- name: Build/release Electron app
4666
uses: samuelmeuli/action-electron-builder@v1

0 commit comments

Comments
 (0)