|
| 1 | +name: Release service-process binaries |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - service-process-v* |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-binaries: |
| 14 | + name: Build (${{ matrix.os }}) |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Node.js |
| 26 | + uses: actions/setup-node@v4 |
| 27 | + with: |
| 28 | + node-version: 22.14.0 |
| 29 | + cache: npm |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + run: npm ci |
| 33 | + |
| 34 | + - name: Build service-process executable |
| 35 | + run: npm run create:executable --workspace=open-collaboration-service-process |
| 36 | + |
| 37 | + - name: Prepare release artifact metadata |
| 38 | + id: meta |
| 39 | + shell: bash |
| 40 | + run: | |
| 41 | + TAG="${GITHUB_REF_NAME}" |
| 42 | + VERSION="${TAG#service-process-v}" |
| 43 | +
|
| 44 | + case "${{ runner.os }}" in |
| 45 | + Linux) |
| 46 | + OS_NAME="linux" |
| 47 | + EXT="" |
| 48 | + ;; |
| 49 | + Windows) |
| 50 | + OS_NAME="windows" |
| 51 | + EXT=".exe" |
| 52 | + ;; |
| 53 | + macOS) |
| 54 | + OS_NAME="macos" |
| 55 | + EXT="" |
| 56 | + ;; |
| 57 | + *) |
| 58 | + echo "Unsupported OS: ${{ runner.os }}" |
| 59 | + exit 1 |
| 60 | + ;; |
| 61 | + esac |
| 62 | +
|
| 63 | + SOURCE="packages/open-collaboration-service-process/bin/oct-service-process${EXT}" |
| 64 | + TARGET="oct-service-process-${VERSION}-${OS_NAME}-x64${EXT}" |
| 65 | +
|
| 66 | + if [ ! -f "$SOURCE" ]; then |
| 67 | + echo "Expected binary not found: $SOURCE" |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | +
|
| 71 | + cp "$SOURCE" "$TARGET" |
| 72 | + echo "asset_name=$TARGET" >> "$GITHUB_OUTPUT" |
| 73 | +
|
| 74 | + - name: Upload binary artifact |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: ${{ steps.meta.outputs.asset_name }} |
| 78 | + path: ${{ steps.meta.outputs.asset_name }} |
| 79 | + if-no-files-found: error |
| 80 | + |
| 81 | + create-release: |
| 82 | + name: Create GitHub release |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: build-binaries |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Download built binaries |
| 88 | + uses: actions/download-artifact@v4 |
| 89 | + with: |
| 90 | + path: release-assets |
| 91 | + |
| 92 | + - name: Flatten artifact directories |
| 93 | + shell: bash |
| 94 | + run: | |
| 95 | + mkdir -p dist |
| 96 | + find release-assets -type f -exec cp {} dist/ \; |
| 97 | +
|
| 98 | + - name: Generate checksums |
| 99 | + shell: bash |
| 100 | + run: | |
| 101 | + cd dist |
| 102 | + sha256sum * > SHA256SUMS.txt |
| 103 | +
|
| 104 | + - name: Publish GitHub release |
| 105 | + uses: softprops/action-gh-release@v2 |
| 106 | + with: |
| 107 | + files: | |
| 108 | + dist/* |
| 109 | + generate_release_notes: true |
0 commit comments