Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/desktop-auto-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Desktop Auto-Tag on Release PR Merge

# When a release/* PR is merged to main, automatically:
# 1. Read the version from apps/desktop/package.json
# 2. Push the git tag (v0.1.8, etc.)
# 3. Create a GitHub Release using the PR body as release notes
#
# This bridges the gap between "merge Release PR" and "desktop-release.yml"
# which triggers on tag push to build + sign + publish artifacts.

on:
pull_request:
types: [closed]
branches: [main]

permissions:
contents: write

jobs:
auto-tag:
# Only run when a release/* PR is merged (not just closed)
if: >-
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest

steps:
- name: Checkout merged commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0

- name: Read version from package.json
id: version
run: |
set -euo pipefail
version=$(node -e 'process.stdout.write(require("./apps/desktop/package.json").version)')
tag="v${version}"

echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "Detected version: $version β†’ tag: $tag"

- name: Check if tag already exists
id: check
run: |
if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Tag ${{ steps.version.outputs.tag }} already exists, skipping"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Push tag
if: steps.check.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "${{ steps.version.outputs.tag }}" "${{ github.event.pull_request.merge_commit_sha }}"
git push origin "${{ steps.version.outputs.tag }}"
echo "Pushed tag ${{ steps.version.outputs.tag }}"

- name: Create GitHub Release with PR body as release notes
if: steps.check.outputs.exists == 'false'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail

tag="${{ steps.version.outputs.tag }}"
pr_number="${{ github.event.pull_request.number }}"

# Extract PR body (the release notes)
pr_body=$(gh pr view "$pr_number" --json body --jq '.body')

# Create the release (draft: false so it publishes immediately)
# desktop-release.yml will detect the tag and upload build artifacts
gh release create "$tag" \
--title "$tag" \
--notes "$pr_body" \
--target "${{ github.event.pull_request.merge_commit_sha }}"

echo "Created GitHub Release $tag with notes from PR #$pr_number"
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nexu/desktop",
"version": "0.1.7",
"version": "0.1.8",
"private": true,
"license": "MIT",
"type": "module",
Expand Down
Loading