Skip to content

Commit cb127b0

Browse files
BoshenDunqing
authored andcommitted
fix release
1 parent 9e805f8 commit cb127b0

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

.github/workflows/release_oxfmt.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,42 @@ jobs:
3838
- os: windows-latest
3939
target: x86_64-pc-windows-msvc
4040
code-target: win32-x64
41+
build-oxfmt-args: ""
4142

4243
- os: windows-latest
4344
target: aarch64-pc-windows-msvc
4445
code-target: win32-arm64
46+
build-oxfmt-args: ""
4547

4648
- os: ubuntu-latest
4749
target: x86_64-unknown-linux-gnu
4850
code-target: linux-x64-gnu
51+
build-oxfmt-args: --use-napi-cross
4952

5053
- os: ubuntu-latest
5154
target: aarch64-unknown-linux-gnu
5255
code-target: linux-arm64-gnu
56+
build-oxfmt-args: --use-napi-cross
5357

5458
- os: ubuntu-latest
5559
target: x86_64-unknown-linux-musl
5660
code-target: linux-x64-musl
61+
build-oxfmt-args: -x
5762

5863
- os: ubuntu-latest
5964
target: aarch64-unknown-linux-musl
6065
code-target: linux-arm64-musl
66+
build-oxfmt-args: -x
6167

6268
- os: macos-latest
6369
target: x86_64-apple-darwin
6470
code-target: darwin-x64
71+
build-oxfmt-args: ""
6572

6673
- os: macos-latest
6774
target: aarch64-apple-darwin
6875
code-target: darwin-arm64
76+
build-oxfmt-args: ""
6977

7078
name: Package ${{ matrix.code-target }}
7179
runs-on: ${{ matrix.os }}
@@ -89,28 +97,37 @@ jobs:
8997
- name: Add Rust Target
9098
run: rustup target add ${{ matrix.target }}
9199

92-
- name: Build
100+
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
101+
102+
- uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
103+
if: ${{ contains(matrix.target, 'musl') }}
104+
with:
105+
version: 0.13.0
106+
107+
- name: Build oxfmt
108+
working-directory: apps/oxfmt
109+
run: pnpm run build-napi-release --target ${{ matrix.target }} ${{ matrix.build-oxfmt-args }}
93110
shell: bash
94111
env:
95112
TARGET_CC: clang # for mimalloc
96-
run: |
97-
cross build --release -p oxfmt --bin oxfmt --features allocator --target=${{ matrix.target }}
98113

99114
# The binaries are zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss
100115
- name: Archive Binaries
101116
if: runner.os == 'Windows'
117+
# Windows `.node` files have `-msvc` postfix e.g. `oxfmt.win32-x64-msvc.node`. Remove the postfix.
102118
run: |
103-
OXFMT_BIN_NAME=oxfmt-${{ matrix.code-target }}
104-
mv target/${{ matrix.target }}/release/oxfmt.exe $OXFMT_BIN_NAME.exe
105-
7z a $OXFMT_BIN_NAME.zip $OXFMT_BIN_NAME.exe
119+
OXFMT_BIN_SRC_NAME=oxfmt.${{ matrix.code-target }}-msvc.node
120+
OXFMT_BIN_NAME=oxfmt.${{ matrix.code-target }}.node
121+
mv apps/oxfmt/src-js/$OXFMT_BIN_SRC_NAME $OXFMT_BIN_NAME
122+
7z a oxfmt-${{ matrix.code-target }}.zip $OXFMT_BIN_NAME
106123
107124
# The binaries are zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss
108125
- name: Archive Binaries
109126
if: runner.os != 'Windows'
110127
run: |
111-
OXFMT_BIN_NAME=oxfmt-${{ matrix.code-target }}
112-
mv target/${{ matrix.target }}/release/oxfmt $OXFMT_BIN_NAME
113-
tar czf $OXFMT_BIN_NAME.tar.gz $OXFMT_BIN_NAME
128+
OXFMT_BIN_NAME=oxfmt.${{ matrix.code-target }}.node
129+
mv apps/oxfmt/src-js/$OXFMT_BIN_NAME .
130+
tar czf oxfmt-${{ matrix.code-target }}.tar.gz $OXFMT_BIN_NAME
114131
115132
- name: Upload Binary
116133
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
@@ -164,6 +181,10 @@ jobs:
164181

165182
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
166183

184+
- name: Generate oxfmt JS build
185+
working-directory: apps/oxfmt
186+
run: pnpm run build-js
187+
167188
- name: Generate npm packages
168189
run: |
169190
node npm/oxfmt/scripts/generate-packages.js

0 commit comments

Comments
 (0)