-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (144 loc) · 5.54 KB
/
Copy pathrelease.yml
File metadata and controls
167 lines (144 loc) · 5.54 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
160
161
162
163
164
165
166
167
name: release
on:
push:
branches:
- main
env:
APP_NAME: hyperiondb-client
jobs:
version:
if: contains(github.event.head_commit.message, '[cd]')
name: compute version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump.outputs.version }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
- name: Compute next version
id: bump
run: |
npm version patch --no-git-tag-version > /dev/null
VERSION="$(node -p "require('./package.json').version")"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
build:
name: build ${{ matrix.settings.target }}
needs: version
runs-on: ${{ matrix.settings.host }}
strategy:
fail-fast: false
matrix:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
build: napi build --platform --release --target x86_64-pc-windows-msvc
#- host: macos-latest
# target: aarch64-apple-darwin
# build: napi build --platform --release --target aarch64-apple-darwin
#- host: macos-latest
# target: x86_64-apple-darwin
# build: napi build --platform --release --target x86_64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: napi build --platform --release --target x86_64-unknown-linux-gnu --cross-compile
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
build: napi build --platform --release --target aarch64-unknown-linux-gnu --cross-compile
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
build: napi build --platform --release --target x86_64-unknown-linux-musl --cross-compile
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
build: napi build --platform --release --target aarch64-unknown-linux-musl --cross-compile
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
- name: Setup Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: ${{ matrix.settings.target }}
- name: Setup zig
if: runner.os == 'Linux'
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
with:
version: 0.14.1
- name: Setup cargo-zigbuild
if: runner.os == 'Linux'
uses: taiki-e/install-action@59012be0884e296ca2da49b530610e72c49039ad # v2.81.6
with:
tool: cargo-zigbuild
- name: Install dependencies
run: npm install
- name: Build
run: npx ${{ matrix.settings.build }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bindings-${{ matrix.settings.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
publish:
name: publish to npm
needs: [version, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: v24
registry-url: https://registry.npmjs.org
- name: Set version
run: npm version ${{ needs.version.outputs.version }} --no-git-tag-version --allow-same-version
- name: Install dependencies
run: npm install
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: artifacts
merge-multiple: true
- name: Assemble platform packages
run: |
npx napi create-npm-dirs
npx napi artifacts
ls -R npm
- name: Publish
run: |
npx napi prepublish -t npm
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
commit:
name: commit version bump
needs: [version, publish]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
- name: Bump and push
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
npm version ${{ needs.version.outputs.version }} --no-git-tag-version --allow-same-version
sed -i -E "0,/^version = \".*\"/ s//version = \"${{ needs.version.outputs.version }}\"/" Cargo.toml
sed -i -E "/^name = \"hyperiondb-client\"$/{n;s/^version = \".*\"/version = \"${{ needs.version.outputs.version }}\"/}" Cargo.lock
git add package.json Cargo.toml Cargo.lock
git commit -m "release: v${{ needs.version.outputs.version }}"
git push origin HEAD:${{ github.ref_name }}