Skip to content

Release

Release #71

Workflow file for this run

name: Release Electron App
on:
# Commented because provokes duplicated builds
# push:
# tags:
# - "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., 1.0.0)"
required: true
draft:
description: "Create as draft release"
type: boolean
default: true
jobs:
# Determine version once on Linux
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: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "is_draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "is_draft=false" >> $GITHUB_OUTPUT
fi
echo "Version determined: $(cat $GITHUB_OUTPUT | grep version)"
build-electron:
name: Build Electron App
needs: determine-version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-15-intel]
steps:
- name: Debug all contexts
run: |
echo "=== Runner Context ==="
echo "runner.os: ${{ runner.os }}"
echo "runner.arch: ${{ runner.arch }}"
echo "runner.name: ${{ runner.name }}"
echo "runner.temp: ${{ runner.temp }}"
echo "runner.workspace: ${{ runner.workspace }}"
echo ""
echo "=== Matrix Context ==="
echo "matrix.os: ${{ matrix.os }}"
echo "matrix.platform: ${{ matrix.platform }}"
echo "matrix.arch: ${{ matrix.arch }}"
echo ""
echo "=== Environment Variables ==="
echo "RUNNER_OS: $RUNNER_OS"
echo "RUNNER_ARCH: $RUNNER_ARCH"
echo "RUNNER_NAME: $RUNNER_NAME"
- name: Checkout repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.26.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
# Update package.json with release version
- name: Update version in package.json
working-directory: electron-app
shell: bash
run: |
pnpm version ${{ needs.determine-version.outputs.version }} --no-git-tag-version
echo "Updated version to:"
cat package.json | grep version
# Download ONLY the appropriate backend for this platform
- name: Download Linux backend
if: runner.os == 'Linux'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-linux
path: electron-app/binaries
- name: Download Windows backend
if: runner.os == 'Windows'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-windows
path: electron-app/binaries
- name: Download macOS Intel backend
if: runner.os == 'macOS' && runner.arch == 'X64'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-macos-intel
path: electron-app/binaries
- name: Download macOS ARM64 backend
if: runner.os == 'macOS' && runner.arch == 'ARM64'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-macos-arm64
path: electron-app/binaries
# Download frontend builds from latest build
# TODO: Uncomment when competition view is ready
# - name: Download competition-view
# uses: dawidd6/action-download-artifact@v3
# with:
# workflow: build.yaml
# branch: production
# workflow_conclusion: success
# name: competition-view
# path: electron-app/renderer/competition-view
- name: Download testing-view
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: testing-view
path: electron-app/renderer/testing-view
- name: Set executable permissions (Unix)
if: runner.os != 'Windows'
run: chmod +x electron-app/binaries/*
- 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: Display structure (Windows)
if: runner.os == 'Windows'
working-directory: electron-app
shell: pwsh
run: Get-ChildItem -Recurse dist/ | Select-Object FullName
- name: Display structure (Unix)
if: runner.os != 'Windows'
working-directory: electron-app
run: ls -laR dist/
- name: Upload electron artifacts
uses: actions/upload-artifact@v4
with:
name: electron-${{ runner.os }}-${{ runner.arch }}
path: |
electron-app/dist/*.exe
electron-app/dist/*.AppImage
electron-app/dist/*.deb
electron-app/dist/*.dmg
electron-app/dist/*.zip
electron-app/dist/*.yml
electron-app/dist/*.blockmap
!electron-app/dist/*-unpacked
!electron-app/dist/mac
!electron-app/dist/win-unpacked
!electron-app/dist/linux-unpacked
if-no-files-found: error
retention-days: 7
# Create GitHub Release
create-release:
name: Create GitHub Release
needs: [build-electron, determine-version]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all electron artifacts
uses: actions/download-artifact@v4
with:
pattern: electron-*
path: dist
merge-multiple: true
- name: Display structure
run: ls -laR dist/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.determine-version.outputs.version }}
name: Hyperloop Control Station v${{ needs.determine-version.outputs.version }}
draft: ${{ needs.determine-version.outputs.is_draft }}
generate_release_notes: true
files: dist/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}