diff --git a/.github/workflows/tagged_release.yaml b/.github/workflows/tagged_release.yaml new file mode 100644 index 0000000..45e8e5d --- /dev/null +++ b/.github/workflows/tagged_release.yaml @@ -0,0 +1,66 @@ +name: Create tagged release +on: + push: + tags: + - v*.*.* + +jobs: + build: + strategy: + matrix: + arch: [ "x64", "arm64" ] + runs-on: macos-11 + steps: + - name: Set up Git repository + uses: actions/checkout@v3 + - name: Set up node + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install + run: npm install --ignore-scripts + - name: Build + run: npm run build -- -a ${{matrix.arch}} + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: permissions-${{matrix.arch}} + path: build/Release/permissions.node + + deploy: + needs: + - build + runs-on: macos-11 + steps: + - name: Set up Git repository + uses: actions/checkout@v3 + - name: Set up node + uses: actions/setup-node@v3 + with: + node-version: 18 + registry-url: 'https://registry.npmjs.org' + - name: Install + run: npm install --ignore-scripts + - name: Create directories + run: | + mkdir -p build/Release + mkdir -p /tmp/artifacts/x64 + mkdir -p /tmp/artifacts/arm64 + - name: Download x64 artifact + uses: actions/download-artifact@v3 + with: + name: permissions-x64 + path: /tmp/artifacts/x64 + - name: Download arm64 artifact + uses: actions/download-artifact@v3 + with: + name: permissions-arm64 + path: /tmp/artifacts/arm64 + - name: Build universal binary + run: | + lipo /tmp/artifacts/x64/permissions.node /tmp/artifacts/arm64/permissions.node -create -output build/Release/permissions.node + lipo -info build/Release/permissions.node + - name: Publish tagged release + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} \ No newline at end of file