fix(CI): provide target on the fly #21
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: Release | |
| on: | |
| push: | |
| branches: [main, staging] | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: node18-linux-x64 | |
| - os: windows-latest | |
| target: node18-win-x64 | |
| - os: macos-latest | |
| target: node18-macos-arm64 | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: write | |
| env: | |
| PKG_TARGET: ${{ matrix.target }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| - run: npm ci | |
| # IMPORTANT for wrtc native binaries | |
| - run: npm rebuild @roamhq/wrtc | |
| - run: npm run build | |
| - run: npm run pkg | |
| # macOS ad-hoc signing | |
| - name: Codesign macOS binary | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| find ./implementations/js/server/dist/bin -type f -exec codesign --force --deep --sign - {} \; | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: npm ci | |
| - name: Release | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |