Skip to content

fix: fix to build latest #12

fix: fix to build latest

fix: fix to build latest #12

Workflow file for this run

name: Generate prebuilds
on:
push:
branches: [main]
tags:
- "*"
env:
NODE_VERSION: 18
MODULE_NAME: "sodium-native"
MODULE_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
arch: ["arm", "arm64", "x64"]
platform: ["android"]
name: ${{ matrix.platform }}-${{ matrix.arch }}
steps:
- name: Assert env.MODULE_VERSION is set
if: ${{ env.MODULE_VERSION == '' }}
run: echo "env.MODULE_VERSION must be set" && exit 1
- uses: actions/checkout@v4
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26 # https://github.com/android/ndk/wiki/Unsupported-Downloads#r24
add-to-path: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Download npm package and unpack
run: npm pack ${{ env.MODULE_NAME }}@${{ env.MODULE_VERSION }} | xargs tar -zxvf
- run: npm install -g bare-make
- name: Install deps for package
working-directory: ./package
run: npm install
- name: Install patched cmake-napi
working-directory: ./package
run: npm install cmake-napi@github:digidem/cmake-napi-nodejs-mobile
- name: Generate
working-directory: ./package
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: bare-make generate --platform ${{ matrix.platform }} --arch ${{ matrix.arch }}
- name: Build
working-directory: ./package
run: bare-make build
- name: Install
working-directory: ./package
run: bare-make install
- name: Define target
id: define_target
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> "$GITHUB_OUTPUT"
- name: Upload original prebuild artifacts # mostly for debugging purposes
uses: actions/upload-artifact@v3
with:
name: ${{ steps.define_target.outputs.target }}
path: ./package/prebuilds/${{ steps.define_target.outputs.target }}
# The below steps are needed for the release job
- name: Derive release artifact name
id: artifact-name
run: echo "NAME=${{ env.MODULE_NAME }}-${{ env.MODULE_VERSION }}-${{ steps.define_target.outputs.target }}" >> "$GITHUB_OUTPUT"
- name: Prepare release artifact
run: tar -czf ${{ steps.artifact-name.outputs.NAME }}.tar.gz --directory=./package/prebuilds/${{ steps.define_target.outputs.target }} .
- name: Upload release artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact-name.outputs.NAME }}
path: ./${{ steps.artifact-name.outputs.NAME }}.tar.gz
release:
if: ${{ startsWith(github.ref, 'refs/tags') }}
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.MODULE_NAME }}-${{ env.MODULE_VERSION }}-*/*.tar.gz"
artifactErrorsFailBuild: true
allowUpdates: true
replacesArtifacts: true