|
| 1 | +name: Build node-packages with prebuilt Node |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + workflow_run: |
| 6 | + workflows: [Build Node] |
| 7 | + types: |
| 8 | + - completed |
| 9 | + pull_request: |
| 10 | + paths: .github/workflows/build-node-packages.yml |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-packages: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - platform: linux |
| 18 | + arch: x64 |
| 19 | + runs_on: ubuntu-22.04 |
| 20 | + - platform: linux |
| 21 | + arch: arm64 |
| 22 | + runs_on: ubuntu-22.04-arm |
| 23 | + runs-on: ${{ matrix.runs_on }} |
| 24 | + |
| 25 | + env: |
| 26 | + NODE_VERSION: v20.18.3 |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Debug Matrix Values |
| 30 | + run: | |
| 31 | + echo "Matrix platform: ${{ matrix.platform }}" |
| 32 | + echo "Matrix arch: ${{ matrix.arch }}" |
| 33 | +
|
| 34 | + - name: Download Node archive |
| 35 | + run: | |
| 36 | + gh release download node-${{ env.NODE_VERSION }}-release \ |
| 37 | + --repo asana/node \ |
| 38 | + --pattern "node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz" |
| 39 | + env: |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + - name: Extract Node archive |
| 43 | + run: | |
| 44 | + mkdir -p node-install |
| 45 | + tar -C node-install -xJf node-${{ env.NODE_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-LATEST.tar.xz |
| 46 | + echo "$GITHUB_WORKSPACE/node-install/usr/local/bin" >> $GITHUB_PATH |
| 47 | +
|
| 48 | + - name: Verify Node Binary Architecture |
| 49 | + run: | |
| 50 | + echo "Node File:" |
| 51 | + file $GITHUB_WORKSPACE/node-install/usr/local/bin/node |
| 52 | + echo "Runner architecture:" |
| 53 | + uname -m |
| 54 | + which node |
| 55 | + node -v |
| 56 | + node -p "process.arch" |
| 57 | + ls |
| 58 | +
|
| 59 | + - name: Build node-packages bcrypt |
| 60 | + run: | |
| 61 | + npm i --nodedir="$GITHUB_WORKSPACE/node-install/usr/local" [email protected] |
| 62 | + |
| 63 | + mkdir [email protected]/node_modules |
| 64 | +
|
| 65 | + - name: Build node-packages cld |
| 66 | + run: | |
| 67 | + npm i --nodedir="$GITHUB_WORKSPACE/node-install/usr/local" [email protected] |
| 68 | + |
| 69 | + mkdir [email protected]/node_modules |
| 70 | +
|
| 71 | + - name: Build node-packages unix-dgram |
| 72 | + run: | |
| 73 | + npm i --nodedir="$GITHUB_WORKSPACE/node-install/usr/local" [email protected] |
| 74 | + |
| 75 | + mkdir [email protected]/node_modules |
| 76 | +
|
| 77 | + - name: Tar node-packages |
| 78 | + run: | |
| 79 | + mv node_modules/bcrypt ./[email protected]/node_modules/bcrypt |
| 80 | + mv node_modules/cld ./[email protected]/node_modules/cld |
| 81 | + mv node_modules/unix-dgram ./[email protected]/node_modules/unix-dgram |
| 82 | + tar --hard-dereference -cvzf packages_${{matrix.arch}}.tar.gz [email protected] [email protected] [email protected] |
| 83 | +
|
| 84 | + - name: Upload archive to release |
| 85 | + uses: softprops/action-gh-release@v1 |
| 86 | + with: |
| 87 | + name: node-${{ env.NODE_VERSION }}-LATEST |
| 88 | + tag_name: node-${{ env.NODE_VERSION }}-release |
| 89 | + files: packages_${{matrix.arch}}.tar.gz |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments