From 4d4b85827146d23b30f2489a16cc9c6f05335b41 Mon Sep 17 00:00:00 2001 From: Michalis Karagiorgos Date: Wed, 14 Jan 2026 22:27:55 +0200 Subject: [PATCH 1/2] automate release process --- .github/workflows/release.yml | 78 +++++++++++++++++++++++++++++++++++ VERSION | 1 + swiftfindrefs.rb | 12 ++++-- 3 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 VERSION diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bb07cf4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release + +on: + workflow_dispatch: + inputs: + bump: + description: "Version bump type" + required: true + default: "patch" + type: choice + options: + - patch + - minor + - major + +permissions: + contents: write # Required for commits, tags, and releases + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history for version detection + + - name: Read current version and bump + id: version + run: | + # Read version from VERSION file + CURRENT=$(cat VERSION | tr -d '\n') + echo "Current version: $CURRENT" + + # Parse version components + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" + + # Bump based on input selection + case "${{ inputs.bump }}" in + major) + NEW_VERSION="$((MAJOR + 1)).0.0" + ;; + minor) + NEW_VERSION="${MAJOR}.$((MINOR + 1)).0" + ;; + patch) + NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" + ;; + esac + + echo "New version: $NEW_VERSION" + echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT + + - name: Update VERSION file + run: | + echo "${{ steps.version.outputs.new }}" > VERSION + + - name: Commit version bump + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add VERSION + git commit -m "bump up version" + git push + + - name: Create and push tag + run: | + NEW_VERSION="${{ steps.version.outputs.new }}" + git tag "$NEW_VERSION" + git push origin "$NEW_VERSION" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.new }} + name: ${{ steps.version.outputs.new }} + generate_release_notes: true diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..abd4105 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2.4 diff --git a/swiftfindrefs.rb b/swiftfindrefs.rb index b50b133..256d1a9 100644 --- a/swiftfindrefs.rb +++ b/swiftfindrefs.rb @@ -1,8 +1,12 @@ +# Version is managed by the VERSION file - do not edit manually +# Run the Release workflow to bump version automatically class Swiftfindrefs < Formula - desc "SwiftFindRefs is a macOS Swift CLI that resolves a project’s DerivedData, reads Xcode’s IndexStore, and reports every file referencing a chosen symbol, with optional verbose tracing for diagnostics." + APP_VERSION = File.read(File.join(__dir__, "VERSION")).strip.freeze + + desc "SwiftFindRefs is a macOS Swift CLI that resolves a project's DerivedData, reads Xcode's IndexStore, and reports every file referencing a chosen symbol, with optional verbose tracing for diagnostics." homepage "https://github.com/michaelversus/SwiftFindRefs" - url "https://github.com/michaelversus/SwiftFindRefs.git", tag: "0.2.4" - version "0.2.4" + url "https://github.com/michaelversus/SwiftFindRefs.git", tag: APP_VERSION + version APP_VERSION depends_on "xcode": [:build] @@ -13,4 +17,4 @@ def install test do system "#{bin}/Swiftfindrefs", "list" end -end \ No newline at end of file +end From 2783cd4ac083dcf4e70486b445c33d9987b3224a Mon Sep 17 00:00:00 2001 From: Michalis Karagiorgos Date: Wed, 14 Jan 2026 22:29:12 +0200 Subject: [PATCH 2/2] remove release workflow to be able to push changes --- .github/workflows/release.yml | 78 ----------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index bb07cf4..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - bump: - description: "Version bump type" - required: true - default: "patch" - type: choice - options: - - patch - - minor - - major - -permissions: - contents: write # Required for commits, tags, and releases - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history for version detection - - - name: Read current version and bump - id: version - run: | - # Read version from VERSION file - CURRENT=$(cat VERSION | tr -d '\n') - echo "Current version: $CURRENT" - - # Parse version components - IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" - - # Bump based on input selection - case "${{ inputs.bump }}" in - major) - NEW_VERSION="$((MAJOR + 1)).0.0" - ;; - minor) - NEW_VERSION="${MAJOR}.$((MINOR + 1)).0" - ;; - patch) - NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" - ;; - esac - - echo "New version: $NEW_VERSION" - echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT - - - name: Update VERSION file - run: | - echo "${{ steps.version.outputs.new }}" > VERSION - - - name: Commit version bump - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add VERSION - git commit -m "bump up version" - git push - - - name: Create and push tag - run: | - NEW_VERSION="${{ steps.version.outputs.new }}" - git tag "$NEW_VERSION" - git push origin "$NEW_VERSION" - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ steps.version.outputs.new }} - name: ${{ steps.version.outputs.new }} - generate_release_notes: true