-
Notifications
You must be signed in to change notification settings - Fork 8
159 lines (132 loc) · 4.52 KB
/
release.yml
File metadata and controls
159 lines (132 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Release
on:
push:
tags:
- 'v*'
permissions: {}
env:
DEBUG: 'napi:*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build - ${{ matrix.target }}
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04-arm
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
steps:
- name: Support longpaths
if: ${{ matrix.os == 'windows-latest' }}
run: git config --system core.longpaths true
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Print rustup toolchain version
shell: bash
id: rustup-version
run: |
export RUST_TOOLCHAIN_VERSION="$(grep 'channel' rust-toolchain.toml | head -1 | awk -F '"' '{print $2}')"
echo "Rust toolchain version: $RUST_TOOLCHAIN_VERSION"
echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: '${{ steps.rustup-version.outputs.RUST_TOOLCHAIN_VERSION }}'
targets: ${{ matrix.target }}
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- uses: mlugg/setup-zig@v2
if: ${{ contains(matrix.target, 'musl') }}
with:
version: 0.15.2
- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
if: ${{ contains(matrix.target, 'musl') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tool: cargo-zigbuild
- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build ${{ matrix.target }}
working-directory: napi/angular-compiler
if: ${{ !contains(matrix.target , 'gnu') && !contains(matrix.target, 'musl') }}
run: pnpm build-dev --release --target ${{ matrix.target }}
- name: Build ${{ matrix.target }}
working-directory: napi/angular-compiler
if: ${{ contains(matrix.target , 'gnu') }}
run: pnpm build-dev --release --target ${{ matrix.target }} --use-napi-cross
env:
TARGET_CC: clang
- name: Build ${{ matrix.target }}
working-directory: napi/angular-compiler
if: ${{ contains(matrix.target, 'musl') }}
run: pnpm build-dev --release --target ${{ matrix.target }} -x
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: bindings-${{ matrix.target }}
path: napi/angular-compiler/*.node
if-no-files-found: error
publish:
name: Publish
permissions:
contents: write
id-token: write
packages: write
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: napi/angular-compiler/artifacts
- name: Create npm dirs
run: pnpm --filter ./napi/angular-compiler exec napi create-npm-dirs
- name: Move artifacts
run: pnpm --filter ./napi/angular-compiler artifacts
- name: Build TypeScript
run: pnpm --filter ./napi/angular-compiler build:ts
- name: Publish to npm
working-directory: napi/angular-compiler
run: |
npm install -g npm
npm publish --access public