Release Electron App #83
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: Release Electron App | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (e.g., 1.0.0)" | |
| required: true | |
| draft: | |
| description: "Create as draft release" | |
| type: boolean | |
| default: true | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| determine-version: | |
| name: Determine Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| is_draft: ${{ steps.get_version.outputs.is_draft }} | |
| steps: | |
| - name: Determine version | |
| id: get_version | |
| run: | | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| echo "is_draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT | |
| create-draft-release: | |
| name: Create Draft Release | |
| needs: determine-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create release | |
| shell: bash | |
| run: | | |
| DRAFT_FLAG="" | |
| if [ "${{ needs.determine-version.outputs.is_draft }}" = "true" ]; then | |
| DRAFT_FLAG="--draft" | |
| fi | |
| gh release create v${{ needs.determine-version.outputs.version }} \ | |
| --title "Control Station v${{ needs.determine-version.outputs.version }}" \ | |
| --generate-notes \ | |
| $DRAFT_FLAG | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-frontend: | |
| name: Build Frontend | |
| needs: determine-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.26.0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build with Turbo | |
| run: pnpm turbo build --filter=testing-view | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: frontend/testing-view/dist/** | |
| retention-days: 1 | |
| build-backend: | |
| name: Build Backend - ${{ matrix.os }} | |
| needs: determine-version | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| binary: backend-windows-amd64.exe | |
| goarch: amd64 | |
| - os: ubuntu-latest | |
| binary: backend-linux-amd64 | |
| goarch: amd64 | |
| - os: macos-latest | |
| binary: backend-darwin-arm64 | |
| goarch: arm64 | |
| - os: macos-15-intel | |
| binary: backend-darwin-amd64 | |
| goarch: amd64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| - name: Install Linux deps | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y gcc | |
| - name: Build backend binary | |
| working-directory: backend/cmd | |
| shell: bash | |
| run: go build -o ../../electron-app/binaries/${{ matrix.binary }} . | |
| env: | |
| CGO_ENABLED: 1 | |
| GOARCH: ${{ matrix.goarch }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: backend-${{ matrix.os }} | |
| path: electron-app/binaries/${{ matrix.binary }} | |
| retention-days: 1 | |
| package-and-upload: | |
| name: Package & Upload - ${{ matrix.os }} | |
| needs: [determine-version, create-draft-release, build-frontend, build-backend] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| binary: backend-windows-amd64.exe | |
| - os: ubuntu-latest | |
| binary: backend-linux-amd64 | |
| - os: macos-latest | |
| binary: backend-darwin-arm64 | |
| - os: macos-15-intel | |
| binary: backend-darwin-amd64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download backend binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: backend-${{ matrix.os }} | |
| path: electron-app/binaries | |
| - name: Set executable permissions (Unix) | |
| if: runner.os != 'Windows' | |
| run: chmod +x electron-app/binaries/* | |
| - name: Download frontend dist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: electron-app/renderer/testing-view | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.26.0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Update version in package.json | |
| working-directory: electron-app | |
| shell: bash | |
| run: pnpm version ${{ needs.determine-version.outputs.version }} --no-git-tag-version | |
| - name: Install Electron dependencies | |
| working-directory: electron-app | |
| run: pnpm install | |
| - name: Build Electron distribution | |
| working-directory: electron-app | |
| run: pnpm run dist | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CSC_IDENTITY_AUTO_DISCOVERY: false | |
| ELECTRON_BUILDER_PUBLISH: never | |
| - name: Upload to GitHub Release | |
| shell: bash | |
| run: | | |
| find electron-app/dist -maxdepth 1 -type f \ | |
| \( -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" \ | |
| -o -name "*.dmg" -o -name "*.zip" -o -name "*.yml" -o -name "*.blockmap" \) \ | |
| | xargs gh release upload v${{ needs.determine-version.outputs.version }} --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |