|
5 | 5 | branches: [main, staging] |
6 | 6 |
|
7 | 7 | jobs: |
| 8 | + build: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - os: ubuntu-latest |
| 13 | + target: node18-linux-x64 |
| 14 | + |
| 15 | + - os: windows-latest |
| 16 | + target: node18-win-x64 |
| 17 | + |
| 18 | + - os: macos-latest |
| 19 | + target: node18-macos-arm64 |
| 20 | + |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + |
| 23 | + permissions: |
| 24 | + contents: write |
| 25 | + |
| 26 | + steps: |
| 27 | + # ---------------------------- |
| 28 | + # Checkout |
| 29 | + # ---------------------------- |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + # ---------------------------- |
| 35 | + # Node |
| 36 | + # ---------------------------- |
| 37 | + - uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: 20 |
| 40 | + registry-url: https://registry.npmjs.org |
| 41 | + cache: npm |
| 42 | + |
| 43 | + # ---------------------------- |
| 44 | + # Install |
| 45 | + # ---------------------------- |
| 46 | + - run: npm ci |
| 47 | + |
| 48 | + # ---------------------------- |
| 49 | + # Ensure correct wrtc native binary |
| 50 | + # ---------------------------- |
| 51 | + - run: npm rebuild @roamhq/wrtc |
| 52 | + working-directory: ./implementations/js/server |
| 53 | + |
| 54 | + # ---------------------------- |
| 55 | + # Build |
| 56 | + # ---------------------------- |
| 57 | + - run: npm run build |
| 58 | + |
| 59 | + # ---------------------------- |
| 60 | + # Package |
| 61 | + # ---------------------------- |
| 62 | + - name: Package server |
| 63 | + run: npx pkg . --targets ${{ matrix.target }} --output ./dist/bin/wsc-server-${{ matrix.target }} |
| 64 | + working-directory: ./implementations/js/server |
| 65 | + # ---------------------------- |
| 66 | + # macOS ad-hoc signing |
| 67 | + # ---------------------------- |
| 68 | + - name: Codesign macOS binary |
| 69 | + if: matrix.os == 'macos-latest' |
| 70 | + run: | |
| 71 | + find ./implementations/js/server/dist/bin -type f -exec codesign --force --deep --sign - {} \; |
| 72 | +
|
| 73 | + # ---------------------------- |
| 74 | + # Upload artifacts |
| 75 | + # ---------------------------- |
| 76 | + - name: Upload artifacts |
| 77 | + uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: build-${{ matrix.target }} |
| 80 | + path: ./implementations/js/server/dist/bin/* |
| 81 | + |
8 | 82 | release: |
| 83 | + needs: build |
| 84 | + |
9 | 85 | runs-on: ubuntu-latest |
10 | 86 |
|
11 | 87 | permissions: |
12 | 88 | contents: write |
13 | 89 |
|
14 | 90 | steps: |
| 91 | + # ---------------------------- |
| 92 | + # Checkout |
| 93 | + # ---------------------------- |
15 | 94 | - uses: actions/checkout@v4 |
16 | 95 | with: |
17 | 96 | fetch-depth: 0 |
18 | 97 |
|
| 98 | + # ---------------------------- |
| 99 | + # Node |
| 100 | + # ---------------------------- |
19 | 101 | - uses: actions/setup-node@v4 |
20 | 102 | with: |
21 | 103 | node-version: 20 |
22 | 104 | registry-url: https://registry.npmjs.org |
| 105 | + cache: npm |
23 | 106 |
|
24 | | - - run: npm install |
| 107 | + # ---------------------------- |
| 108 | + # Install |
| 109 | + # ---------------------------- |
| 110 | + - run: npm ci |
25 | 111 |
|
26 | | - - run: npm run build |
| 112 | + # ---------------------------- |
| 113 | + # Restore binaries EXACTLY where semantic-release expects them |
| 114 | + # ---------------------------- |
| 115 | + - name: Download artifacts |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + path: ./implementations/js/server/dist/bin |
| 119 | + merge-multiple: true |
27 | 120 |
|
| 121 | + # ---------------------------- |
| 122 | + # Release |
| 123 | + # ---------------------------- |
28 | 124 | - name: Release |
29 | 125 | run: npx semantic-release |
30 | 126 | env: |
|
0 commit comments