Build and release Relay Agent #4
Workflow file for this run
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: Build and release Relay Agent | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Validate agent tag version | |
| id: version | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| if [ "${GITHUB_EVENT_NAME}" = "push" ]; then | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Tag version ($TAG_VERSION) does not match agent/package.json ($PACKAGE_VERSION)." | |
| exit 1 | |
| fi | |
| else | |
| echo "Manual workflow_dispatch run detected; skipping tag version validation." | |
| fi | |
| echo "version=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" | |
| build-windows: | |
| runs-on: windows-2025-vs2026 | |
| needs: prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Windows release | |
| run: npm run build:win | |
| - name: Upload Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: relay-agent-windows | |
| path: | | |
| dist/windows/installers/*.exe | |
| if-no-files-found: error | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Linux release | |
| run: npm run build:linux | |
| - name: Upload Linux artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: relay-agent-linux | |
| path: | | |
| dist/linux/installers/*.AppImage | |
| dist/linux/installers/*.deb | |
| dist/linux/installers/*.snap | |
| if-no-files-found: ignore | |
| build-macos: | |
| runs-on: macos-latest | |
| needs: prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build macOS release | |
| run: npm run build:mac | |
| - name: Upload macOS artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: relay-agent-macos | |
| path: | | |
| dist/macos/installers/*.dmg | |
| if-no-files-found: error | |
| release: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| needs: | |
| - prepare | |
| - build-windows | |
| - build-linux | |
| - build-macos | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| - name: Publish GitHub release | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| mapfile -d '' FILES < <(find release-assets -type f -print0) | |
| if [ "${#FILES[@]}" -eq 0 ]; then | |
| echo "No release files were downloaded." | |
| exit 1 | |
| fi | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release upload "$TAG" "${FILES[@]}" --clobber | |
| else | |
| gh release create "$TAG" "${FILES[@]}" --generate-notes --title "$TAG" | |
| fi |