|
| 1 | +name: Automated deploy |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +env: |
| 8 | + VERSION: ${{ github.event.release.tag_name }} |
| 9 | + TARGET_REF: ${{ github.event.release.target_commitish }} |
| 10 | + |
| 11 | +jobs: |
| 12 | + build_x86_64: |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + container: ${{ matrix.container }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: [ ubuntu-20.04, macos-11, windows-2019 ] |
| 19 | + node: [ 14, 16, 18, 19, 20 ] |
| 20 | + exclude: |
| 21 | + - os: windows-2019 |
| 22 | + node: 14 |
| 23 | + include: |
| 24 | + - os: ubuntu-20.04 |
| 25 | + container: ubuntu:18.04 |
| 26 | + env: |
| 27 | + npm_config_msvs_version: 2019 |
| 28 | + npm_config_python: python3.10 |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + ref: ${{ env.TARGET_REF }} |
| 33 | + token: ${{ secrets.GPR_TOKEN }} |
| 34 | + |
| 35 | + - uses: actions/setup-node@v3 |
| 36 | + with: |
| 37 | + node-version: ${{ matrix.node }} |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: npm ci --ignore-scripts |
| 41 | + |
| 42 | + - name: Prebuild package |
| 43 | + run: npx @mapbox/node-pre-gyp configure build package |
| 44 | + |
| 45 | + - name: Upload binaries to GitHub Release |
| 46 | + run: npx node-pre-gyp-github publish |
| 47 | + env: |
| 48 | + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} |
| 49 | + build_musl_x86_64: |
| 50 | + runs-on: ubuntu-20.04 |
| 51 | + container: |
| 52 | + image: node:${{ matrix.node }}-alpine |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + node: [ 14, 16, 18, 19, 20 ] |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v3 |
| 59 | + with: |
| 60 | + ref: ${{ env.TARGET_REF }} |
| 61 | + token: ${{ secrets.GPR_TOKEN }} |
| 62 | + |
| 63 | + - name: Setup env with Node v${{ matrix.node }} |
| 64 | + run: | |
| 65 | + apk add --update |
| 66 | + apk add --no-cache ca-certificates git curl build-base python3 g++ make |
| 67 | +
|
| 68 | + - name: Install dependencies |
| 69 | + run: npm ci --ignore-scripts |
| 70 | + |
| 71 | + - name: Prebuild package |
| 72 | + run: npx @mapbox/node-pre-gyp configure build package |
| 73 | + |
| 74 | + - name: Upload binaries to GitHub Release |
| 75 | + run: | |
| 76 | + CC=x86_64-linux-musl-gcc \ |
| 77 | + CXX=x86_64-linux-musl-g++ \ |
| 78 | + npx node-pre-gyp-github publish |
| 79 | + env: |
| 80 | + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} |
| 81 | + build_aarch64: |
| 82 | + runs-on: ubuntu-20.04 |
| 83 | + container: ubuntu:18.04 |
| 84 | + strategy: |
| 85 | + fail-fast: false |
| 86 | + matrix: |
| 87 | + node: [ 14, 16, 18, 19, 20 ] |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v3 |
| 90 | + with: |
| 91 | + ref: ${{ env.TARGET_REF }} |
| 92 | + token: ${{ secrets.GPR_TOKEN }} |
| 93 | + |
| 94 | + - uses: actions/setup-node@v3 |
| 95 | + with: |
| 96 | + node-version: ${{ matrix.node }} |
| 97 | + architecture: arm64 |
| 98 | + |
| 99 | + - name: Package prebuild |
| 100 | + run: | |
| 101 | + sudo apt-get update |
| 102 | + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu |
| 103 | +
|
| 104 | + - name: Install dependencies |
| 105 | + run: npm ci --ignore-scripts |
| 106 | + |
| 107 | + - name: Prebuild package |
| 108 | + run: | |
| 109 | + CC=aarch64-linux-gnu-gcc \ |
| 110 | + CXX=aarch64-linux-gnu-g++ \ |
| 111 | + npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package |
| 112 | +
|
| 113 | + - name: Upload binaries to GitHub Release |
| 114 | + run: npx node-pre-gyp-github publish |
| 115 | + env: |
| 116 | + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} |
| 117 | + build_musl_aarch64: |
| 118 | + runs-on: ubuntu-20.04 |
| 119 | + container: |
| 120 | + image: node:${{ matrix.node }}-alpine |
| 121 | + strategy: |
| 122 | + fail-fast: false |
| 123 | + matrix: |
| 124 | + node: [ 14, 16, 18, 19, 20 ] |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v3 |
| 127 | + with: |
| 128 | + ref: ${{ env.TARGET_REF }} |
| 129 | + token: ${{ secrets.GPR_TOKEN }} |
| 130 | + |
| 131 | + - name: Setup env with Node v${{ matrix.node }} |
| 132 | + run: | |
| 133 | + apk add --update |
| 134 | + apk add --no-cache ca-certificates git curl build-base python3 g++ make |
| 135 | +
|
| 136 | + - name: Setup musl cross compiler |
| 137 | + run: | |
| 138 | + curl -OL https://musl.cc/aarch64-linux-musl-cross.tgz |
| 139 | + tar -xzvf aarch64-linux-musl-cross.tgz |
| 140 | + $(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version |
| 141 | +
|
| 142 | + - name: Install dependencies |
| 143 | + run: npm ci --ignore-scripts |
| 144 | + |
| 145 | + - name: Prebuild package |
| 146 | + run: | |
| 147 | + CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \ |
| 148 | + CXX=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ \ |
| 149 | + npx @mapbox/node-pre-gyp --target_arch=arm64 configure build package |
| 150 | +
|
| 151 | + - name: Upload binaries to GitHub Release |
| 152 | + run: npx node-pre-gyp-github publish |
| 153 | + env: |
| 154 | + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} |
| 155 | + build_arm: |
| 156 | + runs-on: ubuntu-20.04 |
| 157 | + container: ubuntu:18.04 |
| 158 | + strategy: |
| 159 | + fail-fast: false |
| 160 | + matrix: |
| 161 | + node: [ 14, 16, 18, 19, 20 ] |
| 162 | + steps: |
| 163 | + - uses: actions/checkout@v3 |
| 164 | + with: |
| 165 | + ref: ${{ env.TARGET_REF }} |
| 166 | + token: ${{ secrets.GPR_TOKEN }} |
| 167 | + |
| 168 | + - uses: actions/setup-node@v3 |
| 169 | + with: |
| 170 | + node-version: ${{ matrix.node }} |
| 171 | + architecture: arm |
| 172 | + |
| 173 | + - name: Install ARM cross-compilation tools |
| 174 | + run: sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf |
| 175 | + |
| 176 | + - name: Install dependencies |
| 177 | + run: npm ci --ignore-scripts |
| 178 | + |
| 179 | + - name: Prebuild package |
| 180 | + run: | |
| 181 | + CC=arm-linux-gnueabihf-gcc \ |
| 182 | + CXX=arm-linux-gnueabihf-g++ \ |
| 183 | + npx @mapbox/node-pre-gyp --target_arch=arm configure build package |
| 184 | +
|
| 185 | + - name: Upload binaries to GitHub Release |
| 186 | + run: npx node-pre-gyp-github publish |
| 187 | + env: |
| 188 | + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} |
| 189 | + build_musl_arm: |
| 190 | + runs-on: ubuntu-20.04 |
| 191 | + container: |
| 192 | + image: node:${{ matrix.node }}-alpine |
| 193 | + strategy: |
| 194 | + fail-fast: false |
| 195 | + matrix: |
| 196 | + node: [ 14, 16, 18, 19, 20 ] |
| 197 | + steps: |
| 198 | + - uses: actions/checkout@v3 |
| 199 | + with: |
| 200 | + ref: ${{ env.TARGET_REF }} |
| 201 | + token: ${{ secrets.GPR_TOKEN }} |
| 202 | + |
| 203 | + - name: Setup env with Node v${{ matrix.node }} |
| 204 | + run: | |
| 205 | + apk add --update |
| 206 | + apk add --no-cache ca-certificates git curl build-base python3 g++ make |
| 207 | +
|
| 208 | + - name: Setup musl cross compiler |
| 209 | + run: | |
| 210 | + curl -OL https://musl.cc/arm-linux-musleabihf-cross.tgz |
| 211 | + tar -xzvf arm-linux-musleabihf-cross.tgz |
| 212 | + $(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc --version |
| 213 | +
|
| 214 | + - name: Install dependencies |
| 215 | + run: npm ci --ignore-scripts |
| 216 | + |
| 217 | + - name: Prebuild package |
| 218 | + run: | |
| 219 | + CC=$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-gcc \ |
| 220 | + CXX=$(pwd)/arm-linux-musleabihf-cross/bin/arm-linux-musleabihf-g++ \ |
| 221 | + npx @mapbox/node-pre-gyp --target_arch=arm configure build package |
| 222 | +
|
| 223 | + - name: Upload binaries to GitHub Release |
| 224 | + run: npx node-pre-gyp-github publish |
| 225 | + env: |
| 226 | + NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} |
| 227 | + deploy: |
| 228 | + needs: |
| 229 | + - build_x86_64 |
| 230 | + - build_x86_64_node_ge_18 |
| 231 | + - build_musl_x86_64 |
| 232 | + - build_aarch64 |
| 233 | + - build_musl_aarch64 |
| 234 | + - build_arm |
| 235 | + - build_musl_arm |
| 236 | + runs-on: ubuntu-latest |
| 237 | + steps: |
| 238 | + - uses: actions/checkout@v3 |
| 239 | + with: |
| 240 | + ref: ${{ env.TARGET_REF }} |
| 241 | + token: ${{ secrets.GPR_TOKEN }} |
| 242 | + |
| 243 | + - uses: actions/setup-node@v3 |
| 244 | + with: |
| 245 | + node-version: 18 |
| 246 | + registry-url: 'https://registry.npmjs.org' |
| 247 | + |
| 248 | + - name: Install dependencies |
| 249 | + run: npm ci --ignore-scripts |
| 250 | + |
| 251 | + - name: Publish to npm |
| 252 | + run: npm publish |
| 253 | + env: |
| 254 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 255 | + |
| 256 | + - uses: actions/setup-node@v3 |
| 257 | + with: |
| 258 | + node-version: 18 |
| 259 | + registry-url: 'https://npm.pkg.github.com' |
| 260 | + scope: '@NeuraLegion' |
| 261 | + |
| 262 | + - name: Publish to GPR |
| 263 | + run: npm publish |
| 264 | + env: |
| 265 | + NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }} |
0 commit comments