Build Node binaries for Linux #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Node binaries for Linux | |
on: | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
linux-x64: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
target-node: [14, 16, 18, 19] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
build-args: | | |
PKG_FETCH_OPTION_n=node${{ matrix.target-node }} | |
context: . | |
file: ./Dockerfile.linux | |
platforms: linux/amd64 | |
outputs: type=tar,dest=../out.tar | |
- name: Extract binaries from Docker image | |
run: | | |
tar xvf ../out.tar root/pkg-fetch/dist | |
- name: Check if binary is compiled | |
id: check_file | |
run: | | |
(test -f root/pkg-fetch/dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false | |
- uses: actions/upload-artifact@v4 | |
if: steps.check_file.outputs.EXISTS == 'true' | |
with: | |
name: node${{ matrix.target-node }}-linux-x64 | |
path: root/pkg-fetch/dist/* | |
linux-arm64: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
target-node: [14, 16, 18, 19] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build | |
uses: docker/build-push-action@v2 | |
with: | |
build-args: | | |
TARGET_TOOLCHAIN_ARCH=aarch64 | |
PKG_FETCH_OPTION_a=arm64 | |
PKG_FETCH_OPTION_n=node${{ matrix.target-node }} | |
context: . | |
file: ./Dockerfile.linuxcross | |
platforms: linux/amd64 | |
outputs: type=tar,dest=../out.tar | |
- name: Extract binaries from Docker image | |
run: | | |
tar xvf ../out.tar root/pkg-fetch/dist | |
- name: Check if binary is compiled | |
id: check_file | |
run: | | |
(test -f root/pkg-fetch/dist/*.sha256sum && echo ::set-output name=EXISTS::true) || echo ::set-output name=EXISTS::false | |
- uses: actions/upload-artifact@v4 | |
if: steps.check_file.outputs.EXISTS == 'true' | |
with: | |
name: node${{ matrix.target-node }}-linux-arm64 | |
path: root/pkg-fetch/dist/* |