From d2b62d3995b355842df3f59c0aa794f044d5e821 Mon Sep 17 00:00:00 2001 From: Ante Budimir Date: Mon, 10 Mar 2025 10:09:05 +0200 Subject: [PATCH] =?UTF-8?q?chore=20=F0=9F=94=A7:=20improve=20GitHub=20Acti?= =?UTF-8?q?ons=20workflow=20for=20release=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix workflow triggers to support both manual runs and tag pushes - Add conditional logic to handle different event types - Skip already existing releases to prevent errors - Add completion messages for better feedback - Improve error handling for the release creation process --- .github/workflows/create-releases.yml | 43 +++++++++++++++++++++++---- CHANGELOG.md | 6 +++- package.json | 2 +- src/index.ts | 2 +- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml index 0faa58c..6d39f0d 100644 --- a/.github/workflows/create-releases.yml +++ b/.github/workflows/create-releases.yml @@ -2,6 +2,9 @@ name: Create Releases from Tags on: workflow_dispatch: + push: + tags: + - 'v*' jobs: create-releases: @@ -15,10 +18,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Get all tags sorted by version - TAGS=$(git tag -l | sort -V) - - for TAG in $TAGS; do + if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then + # For tag push events, only create release for the pushed tag + TAG="${{ github.ref_name }}" VERSION=${TAG#v} # Remove 'v' prefix # Extract changelog entry for this version @@ -29,4 +31,35 @@ jobs: --title "Release $TAG" \ --notes "$BODY" \ --repo ${{ github.repository }} - done + + echo "✅ Successfully created release for $TAG" + else + # For manual workflow runs, check each tag + # Get all tags sorted by version + TAGS=$(git tag -l | sort -V) + + for TAG in $TAGS; do + VERSION=${TAG#v} # Remove 'v' prefix + + # Check if release already exists + if ! gh release view $TAG --repo ${{ github.repository }} &>/dev/null; then + # Extract changelog entry for this version + BODY=$(sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d') + + # Create GitHub release + gh release create $TAG \ + --title "Release $TAG" \ + --notes "$BODY" \ + --repo ${{ github.repository }} + + echo "Created release for $TAG" + else + echo "Release for $TAG already exists, skipping" + fi + done + + echo "🎉 Workflow completed successfully! All releases have been processed." + fi + + - name: Completion Message + run: echo "🚀 Release creation process has finished!" diff --git a/CHANGELOG.md b/CHANGELOG.md index 17b39c5..4ac533c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.4] - 2025-03-10 + +- Improve GitHub Actions workflow for release creation () + ## [1.4.3] - 2025-03-10 -- Add coverage for shared utility functions () +- Add coverage for shared utility functions (1092b47) ## [1.4.2] - 2025-03-09 diff --git a/package.json b/package.json index 50dd720..1770380 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antebudimir/eslint-plugin-vanilla-extract", - "version": "1.4.3", + "version": "1.4.4", "description": "ESLint plugin for enforcing best practices in vanilla-extract CSS styles, including CSS property ordering and additional linting rules.", "author": "Ante Budimir", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index e12c0c8..d3447ea 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import customOrderRule from './css-rules/custom-order/rule-definition.js'; export const vanillaExtract = { meta: { name: '@antebudimir/eslint-plugin-vanilla-extract', - version: '1.4.3', + version: '1.4.4', }, rules: { 'alphabetical-order': alphabeticalOrderRule,