-
Notifications
You must be signed in to change notification settings - Fork 526
135 lines (127 loc) · 3.56 KB
/
build-pack-publish.yml
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
name: Prebuildify, package, publish
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ prereleased, released ]
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
container:
- almalinux-devtoolset11
# - alpine
# - linux-armv7
# - linux-armv7l-musl
# - linux-arm64-lts
# - linux-arm64-musl
container: ghcr.io/prebuild/${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx prebuildify --napi --tag-libc --strip
- run: find prebuilds
- uses: actions/upload-artifact@v4
with:
name: prebuild-${{ matrix.container }}
path: ./prebuilds/
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npx prebuildify --napi --strip --arch=x86
- run: npx prebuildify --napi --strip --arch=x64
- run: dir prebuilds
- uses: actions/upload-artifact@v4
with:
name: prebuild-windows
path: ./prebuilds/
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npx prebuildify --napi --strip --arch=arm64
- run: npx prebuildify --napi --strip --arch=x64
- run: find prebuilds
- uses: actions/upload-artifact@v4
with:
name: prebuild-macos
path: ./prebuilds/
pack:
needs:
- build-linux
- build-windows
- build-macos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- uses: actions/download-artifact@v4
with:
path: /tmp/prebuilds/
- name: Coalesce prebuilds from build matrix
run: |
mkdir prebuilds
for d in /tmp/prebuilds/*; do
cp -Rav $d/* prebuilds/
done
- run: chmod a+x prebuilds/*/*.node && find prebuilds -executable -type f
- run: echo "PACK_FILE=$(npm pack)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: package-tgz
path: ${{ env.PACK_FILE }}
publish-npm:
needs: pack
if: github.event_name == 'release'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
with:
name: package-tgz
path: /tmp/package/
- run: npm publish /tmp/package/bcrypt*.tgz
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-gpr:
needs: pack
if: github.event_name == 'release'
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- uses: actions/download-artifact@v4
with:
name: package-tgz
path: /tmp/package/
- run: npm publish /tmp/package/bcrypt*.tgz
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}