Merge branch 'main' of https://github.com/ecrindigital/facetpack #13
This file contains hidden or 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: Publish | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| DEBUG: napi:* | |
| APP_NAME: facetpack-native | |
| MACOSX_DEPLOYMENT_TARGET: '10.13' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: macos-latest | |
| target: x86_64-apple-darwin | |
| build: bun run build --target x86_64-apple-darwin | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| build: bun run build --target aarch64-apple-darwin | |
| - host: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| build: bun run build --target x86_64-pc-windows-msvc | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| build: bun run build --target x86_64-unknown-linux-gnu | |
| - host: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| build: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| bun run build --target aarch64-unknown-linux-gnu | |
| name: Build - ${{ matrix.settings.target }} | |
| runs-on: ${{ matrix.settings.host }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install Rust | |
| uses: dtolnay/rust-action@stable | |
| with: | |
| targets: ${{ matrix.settings.target }} | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| working-directory: packages/facetpack-native | |
| - name: Build native | |
| run: ${{ matrix.settings.build }} | |
| working-directory: packages/facetpack-native | |
| shell: bash | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: packages/facetpack-native/*.node | |
| if-no-files-found: error | |
| universal-macos: | |
| name: Build universal macOS binary | |
| runs-on: macos-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download x86_64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bindings-x86_64-apple-darwin | |
| path: artifacts | |
| - name: Download aarch64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bindings-aarch64-apple-darwin | |
| path: artifacts | |
| - name: Create universal binary | |
| run: | | |
| lipo -create \ | |
| artifacts/facetpack-native.darwin-x64.node \ | |
| artifacts/facetpack-native.darwin-arm64.node \ | |
| -output facetpack-native.darwin-universal.node | |
| - name: Upload universal artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-universal-apple-darwin | |
| path: facetpack-native.darwin-universal.node | |
| if-no-files-found: error | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bindings-x86_64-unknown-linux-gnu | |
| path: packages/facetpack-native | |
| - name: Test facetpack-native | |
| run: bun run test | |
| working-directory: packages/facetpack-native | |
| - name: Build facetpack | |
| run: bun run build | |
| working-directory: packages/facetpack | |
| - name: Test facetpack | |
| run: bun test | |
| working-directory: packages/facetpack | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| needs: [build, test, universal-macos] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Setup Node.js (for npm publish) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: packages/facetpack-native/artifacts | |
| - name: Move artifacts | |
| run: | | |
| mv artifacts/bindings-x86_64-apple-darwin/*.node . 2>/dev/null || true | |
| mv artifacts/bindings-aarch64-apple-darwin/*.node . 2>/dev/null || true | |
| mv artifacts/bindings-x86_64-pc-windows-msvc/*.node . 2>/dev/null || true | |
| mv artifacts/bindings-x86_64-unknown-linux-gnu/*.node . 2>/dev/null || true | |
| mv artifacts/bindings-aarch64-unknown-linux-gnu/*.node . 2>/dev/null || true | |
| mv artifacts/bindings-universal-apple-darwin/*.node . 2>/dev/null || true | |
| rm -rf artifacts | |
| ls -la *.node | |
| working-directory: packages/facetpack-native | |
| - name: Publish facetpack-native | |
| run: npm publish --provenance --access public | |
| working-directory: packages/facetpack-native | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Build facetpack | |
| run: bun run build | |
| working-directory: packages/facetpack | |
| - name: Publish facetpack | |
| run: npm publish --provenance --access public | |
| working-directory: packages/facetpack | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |