generated from digidem/nodejs-mobile-prebuilds-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed0bcab
commit d7a12b8
Showing
3 changed files
with
62 additions
and
95 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,35 @@ | ||
name: Generate prebuilds | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: | ||
- "*" | ||
|
||
env: | ||
NODE_VERSION: 18 | ||
MODULE_NAME: "udx-native" | ||
MODULE_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }} | ||
workflow_dispatch: | ||
inputs: | ||
module_version: | ||
description: "Module version" | ||
required: true | ||
default: "latest" | ||
type: string | ||
publish_release: | ||
description: "Publish release" | ||
required: false | ||
default: true | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 10 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: ["android-arm", "android-arm64", "android-x64"] | ||
|
||
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: r24 # 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 | ||
|
||
- name: Install deps for package | ||
working-directory: ./package | ||
run: npm install | ||
|
||
- name: Generate prebuild for ${{ matrix.target }} | ||
working-directory: ./package | ||
env: | ||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
run: npx --yes [email protected] ${{ matrix.target }} --verbose | ||
|
||
- name: Upload original prebuild artifacts # mostly for debugging purposes | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: ./package/prebuilds/${{ matrix.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 }}-${{ matrix.TARGET }}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Prepare release artifact | ||
run: tar -czf ${{ steps.artifact-name.outputs.NAME }}.tar.gz --directory=./package/prebuilds/${{ matrix.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 | ||
platform: [android] | ||
arch: [arm64, x64, arm] | ||
uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/prebuild.yml@main | ||
with: | ||
module_name: "udx-native" | ||
module_version: ${{ inputs.module_version }} | ||
platform: ${{ matrix.platform }} | ||
arch: ${{ matrix.arch }} | ||
|
||
release: | ||
if: ${{ startsWith(github.ref, 'refs/tags') }} | ||
if: ${{ inputs.publish_release }} | ||
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 | ||
uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/release.yml@main | ||
with: | ||
module_version: ${{ needs.build.outputs.module_version }} |
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
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