Release Electron App #39
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: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to release (e.g. v1.0.11)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| platform: win | |
| artifact: windows | |
| - os: macos-latest | |
| platform: mac | |
| artifact: macos | |
| - os: ubuntu-latest | |
| platform: linux | |
| artifact: linux | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.tag || github.ref }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install root dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Setup curl-impersonate | |
| run: npx tsx scripts/setup-curl.ts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install web dependencies | |
| run: cd web && npm ci | |
| - name: Install desktop dependencies | |
| run: cd desktop && npm ci | |
| - name: Build app | |
| run: npm run app:build | |
| - name: Pack and publish (${{ matrix.platform }}) | |
| run: npx electron-builder --config electron-builder.yml --${{ matrix.platform }} --publish always | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || inputs.tag | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.tag || github.ref }} | |
| fetch-depth: 0 | |
| - name: Resolve tag | |
| id: tag | |
| run: | | |
| TAG="${{ inputs.tag || github.ref_name }}" | |
| echo "name=$TAG" >> "$GITHUB_OUTPUT" | |
| - name: Generate release notes and publish | |
| run: | | |
| TAG="${{ steps.tag.outputs.name }}" | |
| PREV_TAG=$(git tag --sort=-v:refname | grep '^v' | grep -v "^${TAG}$" | head -1) | |
| if [ -z "$PREV_TAG" ]; then | |
| BODY="Initial release" | |
| else | |
| BODY=$(git log "${PREV_TAG}..${TAG}" --no-merges --pretty=format:"%s" \ | |
| | grep -vE "^(chore|docs|ci)(\(.*\))?:" \ | |
| | sed 's/^/- /') | |
| if [ -z "$BODY" ]; then | |
| BODY="Bug fixes and improvements" | |
| fi | |
| fi | |
| echo "$BODY" > /tmp/release-notes.md | |
| gh release edit "$TAG" --draft=false --notes-file /tmp/release-notes.md | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |