Skip to content

Commit 6de6e56

Browse files
committed
feat: generate version.json and include it in releases
will be used in the future for update notification mechanism
1 parent dbf9471 commit 6de6e56

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
create-release:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: 'Install NPM dependencies'
1313
run: npm ci
1414
- name: 'Install LDID'
@@ -24,6 +24,6 @@ jobs:
2424
- name: Upload Release
2525
uses: ncipollo/release-action@v1
2626
with:
27-
artifacts: 'dist/bin/wokwi-cli-*'
27+
artifacts: 'dist/bin/wokwi-cli-*,dist/bin/version.json'
2828
token: ${{ secrets.GITHUB_TOKEN }}
2929
generateReleaseNotes: true

tools/build.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
import { execSync } from 'child_process';
22
import { build } from 'esbuild';
3-
import { readFileSync } from 'fs';
3+
import { mkdirSync, readFileSync, writeFileSync } from 'fs';
44

55
const { version } = JSON.parse(readFileSync('package.json', 'utf8'));
66
const sha = execSync('git rev-parse --short=12 HEAD').toString().trim();
77

8+
const installCommands = {
9+
win32: 'iwr https://wokwi.com/ci/install.ps1 -useb | iex',
10+
default: 'curl -L https://wokwi.com/ci/install.sh | sh',
11+
};
12+
13+
mkdirSync('dist/bin', { recursive: true });
14+
writeFileSync(
15+
'dist/bin/version.json',
16+
JSON.stringify(
17+
{
18+
version,
19+
sha,
20+
install: installCommands,
21+
},
22+
null,
23+
2,
24+
),
25+
);
26+
827
const options = {
928
platform: 'node',
1029
entryPoints: ['./src/main.ts'],

0 commit comments

Comments
 (0)