Skip to content

Commit 1913e5c

Browse files
Build binaries using latest yao-pkg/pkg (#36)
1 parent e3ce7ce commit 1913e5c

File tree

5 files changed

+3053
-2880
lines changed

5 files changed

+3053
-2880
lines changed

.github/workflows/pr.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
build:
8+
test:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install node
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: '18'
18+
node-version: '24'
1919
cache: 'yarn'
2020
- name: Install ldid
2121
uses: MOZGIII/install-ldid-action@v1
@@ -28,7 +28,7 @@ jobs:
2828
- name: Test
2929
run: |
3030
yarn test
31-
- name: Create Binaries
31+
- name: Create binaries
3232
run: |
3333
yarn binary
3434
- name: Rename
@@ -41,16 +41,23 @@ jobs:
4141
- name: Run gzexe
4242
run: |
4343
gzexe astgen-linux
44+
rm astgen-linux~
4445
gzexe astgen-linux-arm
45-
- name: Make executable
46-
run: |
47-
chmod +x astgen-macos
48-
chmod +x astgen-macos-arm
49-
chmod +x astgen-linux
50-
chmod +x astgen-linux-arm
51-
- name: Print stats
52-
run: |
53-
ls -lh
54-
- name: Print version
55-
run: |
56-
./astgen-linux --version
46+
rm astgen-linux-arm~
47+
- name: Print size and version
48+
run: |
49+
ls -lh ./astgen*
50+
ASTGEN_VERSION=$(./astgen-linux --version)
51+
echo "ASTGEN_VERSION=$ASTGEN_VERSION" >> $GITHUB_ENV
52+
echo "astgen version is: $ASTGEN_VERSION"
53+
- name: Upload binaries to pre-release
54+
uses: svenstaro/upload-release-action@v2
55+
with:
56+
prerelease: true
57+
overwrite: true
58+
file_glob: true
59+
repo_token: ${{ secrets.GITHUB_TOKEN }}
60+
file: astgen-*
61+
body: "Pre-release for testing only"
62+
target_commit: ${{ github.head_ref || github.ref_name }}
63+
tag: v${{ env.ASTGEN_VERSION }}

.github/workflows/release.yml

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ on:
55
branches: [master, main]
66
tags: ["*"]
77

8-
concurrency: production
9-
108
jobs:
11-
build:
9+
release:
10+
concurrency: release
1211
runs-on: ubuntu-latest
1312
steps:
1413
- name: Checkout
@@ -18,33 +17,22 @@ jobs:
1817
- name: Install node
1918
uses: actions/setup-node@v4
2019
with:
21-
node-version: '18'
20+
node-version: '24'
2221
cache: 'yarn'
2322
- name: Install ldid
2423
uses: MOZGIII/install-ldid-action@v1
2524
with:
2625
tag: v2.1.5-procursus6
27-
- name: Get next release version (dry run)
28-
id: taggerDryRun
29-
uses: anothrNick/[email protected]
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
WITH_V: true
33-
DRY_RUN: true
34-
- name: echo new tag
35-
run: |
36-
echo "The next tag version will be: ${{ steps.taggerDryRun.outputs.new_tag }}"
37-
- name: echo tag
38-
run: |
39-
echo "The current tag is: ${{ steps.taggerDryRun.outputs.tag }}"
4026
- name: Build
4127
run: |
4228
yarn install
4329
yarn build
44-
yarn binary
4530
- name: Test
4631
run: |
4732
yarn test
33+
- name: Create binaries
34+
run: |
35+
yarn binary
4836
- name: Rename
4937
run: |
5038
mv astgen-linux-x64 astgen-linux
@@ -55,26 +43,21 @@ jobs:
5543
- name: Run gzexe
5644
run: |
5745
gzexe astgen-linux
46+
rm astgen-linux~
5847
gzexe astgen-linux-arm
59-
- name: Make executable
48+
rm astgen-linux-arm~
49+
- name: Print size and version
6050
run: |
61-
chmod +x astgen-macos
62-
chmod +x astgen-macos-arm
63-
chmod +x astgen-linux
64-
chmod +x astgen-linux-arm
65-
- name: Set next release version
66-
id: taggerFinal
67-
uses: anothrNick/[email protected]
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70-
WITH_V: true
71-
- name: Release
72-
uses: softprops/action-gh-release@v1
51+
ls -lh ./astgen*
52+
ASTGEN_VERSION=$(./astgen-linux --version)
53+
echo "ASTGEN_VERSION=$ASTGEN_VERSION" >> $GITHUB_ENV
54+
echo "astgen version is: $ASTGEN_VERSION"
55+
- name: Upload binaries to release
56+
uses: svenstaro/upload-release-action@v2
7357
with:
74-
tag_name: ${{ steps.taggerDryRun.outputs.new_tag }}
75-
files: |
76-
astgen-win.exe
77-
astgen-macos
78-
astgen-macos-arm
79-
astgen-linux
80-
astgen-linux-arm
58+
promote: true
59+
overwrite: true
60+
file_glob: true
61+
repo_token: ${{ secrets.GITHUB_TOKEN }}
62+
file: astgen-*
63+
tag: v${{ env.ASTGEN_VERSION }}

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,28 @@ Type maps are generated using the Typescript compiler / type checker API.
2121
```bash
2222
yarn install
2323
yarn build
24+
```
25+
26+
Platform-specific binaries can now be build using [pkg](https://github.com/yao-pkg/pkg):
27+
28+
```bash
2429
yarn binary
2530
```
2631

27-
This will invoke `pgk` after `yarn install` and generates a native binary for Windows, MacOS, and Linux.
32+
## Testing
33+
34+
```bash
35+
yarn install
36+
yarn build
37+
yarn test
38+
```
39+
40+
This will use `jest` with `ts-jest` to run the tests in `test/`.
2841

2942
## Getting Help
3043

3144
```bash
32-
bin/astgen -h
45+
./astgen -h
3346
Options:
3447
-v, --version Print version number [boolean]
3548
-i, --src Source directory [default: "."]

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@joernio/astgen",
3-
"version": "3.29.0",
3+
"version": "3.30.0",
44
"description": "Generate JS/TS AST in json format with Babel",
55
"exports": "./index.js",
66
"keywords": [
@@ -17,13 +17,13 @@
1717
"@babel/parser": "^7.27.3",
1818
"n-readlines": "^1.0.1",
1919
"readdirp": "^4.1.2",
20-
"yargs": "^17.7.2",
21-
"typescript": "^5.8.3"
20+
"typescript": "^5.8.3",
21+
"yargs": "^17.7.2"
2222
},
2323
"scripts": {
2424
"test": "jest --silent --config=jest.config.js",
2525
"build": "tsc --build",
26-
"binary": "pkg . --options max-old-space-size=8192 --no-bytecode --no-native-build --public --compress GZip --targets node18-linux-x64,node18-linux-arm64,node18-macos-x64,node18-win-x64,node18-macos-arm64"
26+
"binary": "pkg . --options max-old-space-size=8192 --no-bytecode --no-native-build --compress GZip --targets node18-linux-x64,node18-linux-arm64,node18-macos-x64,node18-win-x64,node18-macos-arm64"
2727
},
2828
"engines": {
2929
"node": ">=18.0.0"
@@ -36,13 +36,12 @@
3636
},
3737
"devDependencies": {
3838
"@tsconfig/node18": "^18.2.4",
39+
"@types/jest": "^30.0.0",
3940
"@types/n-readlines": "^1.0.6",
40-
"@types/jest": "^29.5.14",
4141
"@types/node": "^18.11.9",
4242
"@types/yargs": "^17.0.33",
43-
"cross-env": "^7.0.3",
44-
"jest": "^29.7.0",
45-
"pkg": "^5.8.1",
43+
"@yao-pkg/pkg": "^6.5.1",
44+
"jest": "^30.0.4",
4645
"ts-jest": "^29.3.4"
4746
}
4847
}

0 commit comments

Comments
 (0)