Skip to content

Commit 1cf3204

Browse files
committed
feat: add npm packaging and publishing workflow
1 parent 3e04093 commit 1cf3204

12 files changed

Lines changed: 226 additions & 26 deletions

File tree

.github/workflows/build-npm.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build npm packages
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
package:
8+
name: npm packages
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v6
12+
13+
- uses: actions/download-artifact@v4
14+
with:
15+
path: artifacts
16+
merge-multiple: true
17+
18+
- name: Populate platform packages
19+
run: |
20+
cp artifacts/act-linux-x86_64 npm/@actcore/act-cli-linux-x64/act
21+
cp artifacts/act-linux-aarch64 npm/@actcore/act-cli-linux-arm64/act
22+
cp artifacts/act-macos-x86_64 npm/@actcore/act-cli-darwin-x64/act
23+
cp artifacts/act-macos-aarch64 npm/@actcore/act-cli-darwin-arm64/act
24+
cp artifacts/act-windows-x86_64.exe npm/@actcore/act-cli-win32-x64/act.exe
25+
cp artifacts/act-windows-aarch64.exe npm/@actcore/act-cli-win32-arm64/act.exe
26+
27+
chmod +x npm/@actcore/act-cli-linux-x64/act
28+
chmod +x npm/@actcore/act-cli-linux-arm64/act
29+
chmod +x npm/@actcore/act-cli-darwin-x64/act
30+
chmod +x npm/@actcore/act-cli-darwin-arm64/act
31+
32+
- name: Pack npm packages
33+
run: |
34+
mkdir -p dist-npm
35+
for dir in npm/@actcore/act-cli-*/; do
36+
(cd "$dir" && npm pack --pack-destination ../../../dist-npm)
37+
done
38+
(cd npm/act-cli && npm pack --pack-destination ../../dist-npm)
39+
40+
- uses: actions/upload-artifact@v4
41+
with:
42+
name: npm-packages
43+
path: dist-npm/*.tgz

.github/workflows/build.yml

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ jobs:
2121
os: ubuntu-24.04-arm
2222
src: act
2323
dest: act-linux-aarch64
24+
- name: macos-x86_64
25+
os: macos-13
26+
src: act
27+
dest: act-macos-x86_64
28+
- name: macos-aarch64
29+
os: macos-latest
30+
src: act
31+
dest: act-macos-aarch64
2432
- name: windows-x86_64
2533
os: windows-latest
2634
src: act.exe
@@ -47,32 +55,6 @@ jobs:
4755
name: ${{ matrix.dest }}
4856
path: ${{ matrix.dest }}
4957

50-
macos-universal:
51-
name: Build (macos-universal)
52-
runs-on: macos-latest
53-
steps:
54-
- uses: actions/checkout@v6
55-
- uses: moonrepo/setup-rust@v1
56-
with:
57-
channel: nightly
58-
targets: x86_64-apple-darwin,aarch64-apple-darwin
59-
bins: wit-deps-cli
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
- run: wit-deps
63-
- run: cargo build --release --target aarch64-apple-darwin
64-
- run: cargo build --release --target x86_64-apple-darwin
65-
- name: Create universal binary
66-
run: |
67-
lipo -create \
68-
target/aarch64-apple-darwin/release/act \
69-
target/x86_64-apple-darwin/release/act \
70-
-output act-macos-universal
71-
- uses: actions/upload-artifact@v7
72-
with:
73-
name: act-macos-universal
74-
path: act-macos-universal
75-
7658
zigbuild:
7759
name: Build (${{ matrix.name }})
7860
runs-on: ubuntu-latest

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ jobs:
6060
build-pypi:
6161
needs: [check, fmt]
6262
uses: ./.github/workflows/build-pypi.yml
63+
64+
build-npm:
65+
needs: build
66+
uses: ./.github/workflows/build-npm.yml

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ jobs:
1717
build-pypi:
1818
uses: ./.github/workflows/build-pypi.yml
1919

20+
build-npm:
21+
needs: build
22+
uses: ./.github/workflows/build-npm.yml
23+
2024
release:
2125
name: GitHub Release
2226
needs: build
@@ -52,3 +56,25 @@ jobs:
5256
merge-multiple: true
5357
path: dist
5458
- uses: pypa/gh-action-pypi-publish@release/v1
59+
60+
npm-publish:
61+
name: Publish to npm
62+
needs: build-npm
63+
runs-on: ubuntu-latest
64+
environment: npm
65+
steps:
66+
- uses: actions/download-artifact@v4
67+
with:
68+
name: npm-packages
69+
path: dist-npm
70+
- uses: actions/setup-node@v4
71+
with:
72+
node-version: "22"
73+
registry-url: "https://registry.npmjs.org"
74+
- name: Publish all packages
75+
run: |
76+
for pkg in dist-npm/*.tgz; do
77+
npm publish "$pkg" --access public
78+
done
79+
env:
80+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@actcore/act-cli-darwin-arm64",
3+
"version": "0.2.0",
4+
"description": "act-cli binary for darwin-arm64",
5+
"license": "MIT OR Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/actcore/act-cli"
9+
},
10+
"os": ["darwin"],
11+
"cpu": ["arm64"],
12+
"files": ["act*"]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@actcore/act-cli-darwin-x64",
3+
"version": "0.2.0",
4+
"description": "act-cli binary for darwin-x64",
5+
"license": "MIT OR Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/actcore/act-cli"
9+
},
10+
"os": ["darwin"],
11+
"cpu": ["x64"],
12+
"files": ["act*"]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@actcore/act-cli-linux-arm64",
3+
"version": "0.2.0",
4+
"description": "act-cli binary for linux-arm64",
5+
"license": "MIT OR Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/actcore/act-cli"
9+
},
10+
"os": ["linux"],
11+
"cpu": ["arm64"],
12+
"files": ["act*"]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@actcore/act-cli-linux-x64",
3+
"version": "0.2.0",
4+
"description": "act-cli binary for linux-x64",
5+
"license": "MIT OR Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/actcore/act-cli"
9+
},
10+
"os": ["linux"],
11+
"cpu": ["x64"],
12+
"files": ["act*"]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@actcore/act-cli-win32-arm64",
3+
"version": "0.2.0",
4+
"description": "act-cli binary for win32-arm64",
5+
"license": "MIT OR Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/actcore/act-cli"
9+
},
10+
"os": ["win32"],
11+
"cpu": ["arm64"],
12+
"files": ["act*"]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@actcore/act-cli-win32-x64",
3+
"version": "0.2.0",
4+
"description": "act-cli binary for win32-x64",
5+
"license": "MIT OR Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/actcore/act-cli"
9+
},
10+
"os": ["win32"],
11+
"cpu": ["x64"],
12+
"files": ["act*"]
13+
}

0 commit comments

Comments
 (0)