Create Release #28
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: Create Release | |
| on: | |
| # Trigger when Update workflow completes (bypasses GITHUB_TOKEN limitation) | |
| workflow_run: | |
| workflows: ["Auto-update Cursor"] | |
| types: | |
| - completed | |
| # Keep push trigger for manual merges by humans | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'package.nix' | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| name: Create GitHub release | |
| runs-on: ubuntu-latest | |
| # Only run if: workflow_dispatch, push event, OR workflow_run that succeeded | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| github.event_name == 'push' || | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if release needed | |
| id: release_check | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Get current version from package.nix | |
| CURRENT_VERSION=$(grep -oP 'version = "\K[^"]+' package.nix | head -1) | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| echo "Current version: $CURRENT_VERSION" | |
| # Check if release already exists for this version | |
| if gh release view "v$CURRENT_VERSION" >/dev/null 2>&1; then | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| echo "Release v$CURRENT_VERSION already exists, skipping" | |
| else | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| echo "Release v$CURRENT_VERSION does not exist, will create" | |
| fi | |
| - name: Create release | |
| if: steps.release_check.outputs.should_release == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VERSION: ${{ steps.release_check.outputs.current_version }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "v$VERSION" -m "Cursor v$VERSION" | |
| git push origin "v$VERSION" | |
| gh release create "v$VERSION" \ | |
| --title "Cursor v$VERSION" \ | |
| --notes "Auto-updated Cursor to version $VERSION. | |
| ## Installation | |
| \`\`\`nix | |
| inputs.code-cursor-nix.url = \"github:jacopone/code-cursor-nix/v$VERSION\"; | |
| \`\`\` | |
| ## What's New | |
| See: https://www.cursor.com/changelog | |
| ## Features | |
| - 🌐 Browser Automation: Chrome bundled for Playwright/Puppeteer/Selenium | |
| - 🚀 Auto-updating: Updates 3x weekly | |
| - 📦 Multi-platform: Linux & macOS (x86_64, aarch64)" | |
| echo "✓ Created release v$VERSION" |