diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 41ad2fd..caef6d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,60 @@ jobs: body: This is an automated release for ${{ github.ref }}. It will be used to speed up `npm install`. env: GITHUB_TOKEN: ${{ github.token }} + linux-arm: + runs-on: ubuntu-latest + needs: create_release + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Cache Node Dependencies + id: cache + uses: actions/cache@v2 + with: + path: ./node_modules + key: modules-${{ hashFiles('package-lock.json') }} + - name: Build for arm + run: docker run --platform linux/arm -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh + - name: upload linux artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./build/Release/node-raylib.node + asset_name: node-raylib-4.0-linux-arm.node + asset_content_type: application/octet-stream + linux-arm64: + runs-on: ubuntu-latest + needs: create_release + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Cache Node Dependencies + id: cache + uses: actions/cache@v2 + with: + path: ./node_modules + key: modules-${{ hashFiles('package-lock.json') }} + - name: Build for arm + run: docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh + - name: upload linux artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./build/Release/node-raylib.node + asset_name: node-raylib-4.0-linux-arm64.node + asset_content_type: application/octet-stream linux: runs-on: ubuntu-latest needs: create_release diff --git a/tools/crossbuild.sh b/tools/crossbuild.sh new file mode 100755 index 0000000..db8bc02 --- /dev/null +++ b/tools/crossbuild.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# this is used inside a docker (running with qemu binfmt) to easily crossbuild project +# run with docker run --platform linux/arm64 -it --rm -v "${PWD}:/work" -w /work node ./tools/crossbuild.sh + +apt-get update +apt-get install -y xorg-dev libglu1-mesa-dev cmake +npm ci +npm run compile \ No newline at end of file