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
56 changes: 49 additions & 7 deletions .github/workflows/release-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Find previous desktop release tag
id: prev_tag
run: |
CURRENT_TAG="${{ github.ref_name }}"
# Get all desktop tags sorted by version, find the one before current
PREVIOUS_TAG=$(git tag -l 'desktop-v*' | sort -V | grep -B1 "^${CURRENT_TAG}$" | head -1)
if [ "$PREVIOUS_TAG" = "$CURRENT_TAG" ] || [ -z "$PREVIOUS_TAG" ]; then
# Current tag is the first or no previous found, get the oldest desktop tag
PREVIOUS_TAG=""
fi
echo "current_tag=${CURRENT_TAG}" >> $GITHUB_OUTPUT
echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_OUTPUT
echo "Current tag: ${CURRENT_TAG}"
echo "Previous tag: ${PREVIOUS_TAG:-none}"

- name: Download all artifacts
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -64,12 +81,37 @@ jobs:
echo "Release artifacts:"
ls -la

- name: Generate release notes
id: release_notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PREVIOUS_TAG="${{ steps.prev_tag.outputs.previous_tag }}"
CURRENT_TAG="${{ steps.prev_tag.outputs.current_tag }}"

if [ -n "$PREVIOUS_TAG" ]; then
echo "Generating notes from ${PREVIOUS_TAG} to ${CURRENT_TAG}"
NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes \
-f tag_name="${CURRENT_TAG}" \
-f previous_tag_name="${PREVIOUS_TAG}" \
--jq '.body')
else
echo "No previous tag found, generating notes without comparison"
NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes \
-f tag_name="${CURRENT_TAG}" \
--jq '.body')
fi

# Write to file to preserve formatting
echo "$NOTES" > release_notes.md
echo "Release notes generated"

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release-artifacts/*
draft: true
generate_release_notes: true
name: Superset Desktop ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
release-artifacts/* \
--title "Superset Desktop ${{ github.ref_name }}" \
--notes-file release_notes.md \
--draft
27 changes: 24 additions & 3 deletions apps/desktop/create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# Based on apps/desktop/RELEASE.md
#
# Usage:
# ./create-release.sh [version] [--publish]
# ./create-release.sh [version] [--publish] [--merge]
# Example: ./create-release.sh # Interactive version selection
# Example: ./create-release.sh 0.0.1 # Explicit version
# Example: ./create-release.sh 0.0.1 --publish
# Example: ./create-release.sh --publish # Interactive + auto-publish
# Example: ./create-release.sh --publish --merge # Auto-publish and merge PR
#
# This script will:
# 1. Prompt for version if not provided (patch/minor/major/custom)
Expand All @@ -19,12 +20,14 @@
# 6. Create and push a git tag to trigger the release workflow
# 7. Monitor the GitHub Actions workflow in real-time
# 8. Leave release as draft (default) or auto-publish with --publish flag
# 9. With --merge flag: merge the PR and delete the branch after publishing
#
# Features:
# - Interactive version selection with patch/minor/major options
# - Supports republishing: Running with same version will clean up and rebuild
# - Draft by default for review before publishing
# - Use --publish flag to auto-publish when build completes
# - Use --merge flag to merge the PR and delete the branch after publishing
#
# Requirements:
# - GitHub CLI (gh) installed and authenticated
Expand Down Expand Up @@ -83,20 +86,24 @@ increment_major() {
# Parse arguments
VERSION=""
AUTO_PUBLISH=false
AUTO_MERGE=false

for arg in "$@"; do
case $arg in
--publish)
AUTO_PUBLISH=true
;;
--merge)
AUTO_MERGE=true
;;
-*)
error "Unknown option: $arg\nUsage: $0 [version] [--publish]"
error "Unknown option: $arg\nUsage: $0 [version] [--publish] [--merge]"
;;
*)
if [ -z "$VERSION" ]; then
VERSION="$arg"
else
error "Unexpected argument: $arg\nUsage: $0 [version] [--publish]"
error "Unexpected argument: $arg\nUsage: $0 [version] [--publish] [--merge]"
fi
;;
esac
Expand Down Expand Up @@ -273,12 +280,14 @@ success "Changes pushed to ${CURRENT_BRANCH}"

# Create PR if not on main branch
MAIN_BRANCH="main"
PR_NUMBER=""
if [ "${CURRENT_BRANCH}" != "${MAIN_BRANCH}" ]; then
# Check if PR already exists for this branch
EXISTING_PR=$(gh pr list --head "${CURRENT_BRANCH}" --json number --jq '.[0].number' 2>/dev/null || echo "")

if [ -n "$EXISTING_PR" ]; then
info "PR #${EXISTING_PR} already exists for branch ${CURRENT_BRANCH}"
PR_NUMBER="$EXISTING_PR"
else
info "Creating pull request..."
PR_URL=$(gh pr create \
Expand All @@ -291,6 +300,8 @@ This PR was automatically created by the release script." \

if [ $? -eq 0 ]; then
success "Pull request created: ${PR_URL}"
# Extract PR number from URL
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
else
warn "Could not create PR: ${PR_URL}"
fi
Expand Down Expand Up @@ -395,6 +406,16 @@ else
gh release edit "${TAG_NAME}" --draft=false
success "Release published!"

# Merge the PR if one exists and --merge flag was provided
if [ "$AUTO_MERGE" = true ] && [ -n "$PR_NUMBER" ]; then
info "Merging PR #${PR_NUMBER}..."
if gh pr merge "${PR_NUMBER}" --squash --delete-branch; then
success "PR #${PR_NUMBER} merged and branch deleted"
else
warn "Could not merge PR #${PR_NUMBER}. You may need to merge it manually."
fi
fi

echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}🎉 Release Published!${NC}"
Expand Down