|
1 | 1 | name: Generate prebuilds
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: [main] |
6 |
| - tags: |
7 |
| - - "*" |
8 |
| - |
9 |
| -env: |
10 |
| - NODE_VERSION: 18 |
11 |
| - MODULE_NAME: "fs-native-extensions" |
12 |
| - MODULE_VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }} |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + module_version: |
| 7 | + description: "Module version" |
| 8 | + required: true |
| 9 | + default: "latest" |
| 10 | + type: string |
| 11 | + publish_release: |
| 12 | + description: "Publish release" |
| 13 | + required: false |
| 14 | + default: true |
| 15 | + type: boolean |
13 | 16 |
|
14 | 17 | jobs:
|
15 | 18 | build:
|
16 |
| - runs-on: ubuntu-20.04 |
17 |
| - timeout-minutes: 10 |
18 | 19 | strategy:
|
19 |
| - fail-fast: false |
20 | 20 | matrix:
|
21 |
| - target: ["android-arm", "android-arm64", "android-x64"] |
22 |
| - |
23 |
| - steps: |
24 |
| - - name: Assert env.MODULE_VERSION is set |
25 |
| - if: ${{ env.MODULE_VERSION == '' }} |
26 |
| - run: echo "env.MODULE_VERSION must be set" && exit 1 |
27 |
| - |
28 |
| - - uses: actions/checkout@v4 |
29 |
| - |
30 |
| - - name: Setup NDK |
31 |
| - uses: nttld/setup-ndk@v1 |
32 |
| - id: setup-ndk |
33 |
| - with: |
34 |
| - ndk-version: r24 # https://github.com/android/ndk/wiki/Unsupported-Downloads#r24 |
35 |
| - add-to-path: false |
36 |
| - |
37 |
| - - name: Use Node.js ${{ env.NODE_VERSION }} |
38 |
| - uses: actions/setup-node@v3 |
39 |
| - with: |
40 |
| - node-version: ${{ env.NODE_VERSION }} |
41 |
| - |
42 |
| - - name: Download npm package and unpack |
43 |
| - run: npm pack ${{ env.MODULE_NAME }}@${{ env.MODULE_VERSION }} | xargs tar -zxvf |
44 |
| - |
45 |
| - - name: Install deps for package |
46 |
| - working-directory: ./package |
47 |
| - run: npm install |
48 |
| - |
49 |
| - - name: Generate prebuild for ${{ matrix.target }} |
50 |
| - working-directory: ./package |
51 |
| - env: |
52 |
| - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} |
53 |
| - run: npx --yes [email protected] ${{ matrix.target }} --verbose |
54 |
| - |
55 |
| - - name: Upload original prebuild artifacts # mostly for debugging purposes |
56 |
| - uses: actions/upload-artifact@v3 |
57 |
| - with: |
58 |
| - name: ${{ matrix.target }} |
59 |
| - path: ./package/prebuilds/${{ matrix.target }} |
60 |
| - |
61 |
| - # The below steps are needed for the release job |
62 |
| - |
63 |
| - - name: Derive release artifact name |
64 |
| - id: artifact-name |
65 |
| - run: echo "NAME=${{ env.MODULE_NAME }}-${{ env.MODULE_VERSION }}-${{ matrix.TARGET }}" >> "$GITHUB_OUTPUT" |
66 |
| - |
67 |
| - - name: Prepare release artifact |
68 |
| - run: tar -czf ${{ steps.artifact-name.outputs.NAME }}.tar.gz --directory=./package/prebuilds/${{ matrix.TARGET }} . |
69 |
| - |
70 |
| - - name: Upload release artifact |
71 |
| - uses: actions/upload-artifact@v3 |
72 |
| - with: |
73 |
| - name: ${{ steps.artifact-name.outputs.NAME }} |
74 |
| - path: ./${{ steps.artifact-name.outputs.NAME }}.tar.gz |
| 21 | + platform: [android] |
| 22 | + arch: [arm64, x64, arm] |
| 23 | + uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/prebuild.yml@main |
| 24 | + with: |
| 25 | + module_name: "fs-native-extensions" |
| 26 | + module_version: ${{ inputs.module_version }} |
| 27 | + platform: ${{ matrix.platform }} |
| 28 | + arch: ${{ matrix.arch }} |
75 | 29 |
|
76 | 30 | release:
|
77 |
| - if: ${{ startsWith(github.ref, 'refs/tags') }} |
| 31 | + if: ${{ inputs.publish_release }} |
78 | 32 | needs: build
|
79 |
| - runs-on: ubuntu-latest |
80 |
| - timeout-minutes: 10 |
81 |
| - steps: |
82 |
| - - uses: actions/checkout@v4 |
83 |
| - |
84 |
| - - name: Download artifacts |
85 |
| - uses: actions/download-artifact@v3 |
86 |
| - |
87 |
| - - name: Create GitHub Release |
88 |
| - uses: ncipollo/release-action@v1 |
89 |
| - with: |
90 |
| - artifacts: "${{ env.MODULE_NAME }}-${{ env.MODULE_VERSION }}-*/*.tar.gz" |
91 |
| - artifactErrorsFailBuild: true |
92 |
| - allowUpdates: true |
93 |
| - replacesArtifacts: true |
| 33 | + uses: digidem/nodejs-mobile-bare-prebuilds/.github/workflows/release.yml@main |
| 34 | + with: |
| 35 | + module_version: ${{ needs.build.outputs.module_version }} |
0 commit comments