From 484b919fcf26e909e58b7446fe1f98ac2f65fb12 Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Fri, 27 Mar 2026 10:45:28 -0500 Subject: [PATCH 1/5] Add Release Workflow --- .github/workflows/release.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c89509d7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Publish gem to rubygems.org + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + push: + runs-on: ubuntu-latest + + permissions: + contents: write + id-token: write + + steps: + - uses: actions/checkout@v6 + with: { persist-credentials: false } + - uses: ruby/setup-ruby@v1 + with: { bundler-cache: true } + - uses: rubygems/release-gem@v1 From d8e45d49184bd80f3ffbab33f9f0ca2890026e6d Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Fri, 27 Mar 2026 11:34:10 -0500 Subject: [PATCH 2/5] spike on a bump version workflow --- .github/workflows/bump_version.yml | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/bump_version.yml diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml new file mode 100644 index 00000000..aa2c6d0f --- /dev/null +++ b/.github/workflows/bump_version.yml @@ -0,0 +1,71 @@ +name: Bump Version & Publish a Github Release + +on: + workflow_dispatch: + inputs: + version_bump: + description: SemVer Bump Type + required: true + type: choice + options: + - patch + - minor + - major + +permissions: + contents: write + +jobs: + push: + runs-on: ubuntu-latest + + permissions: + contents: write + id-token: write + + steps: + - uses: actions/checkout@v6 + - uses: ruby/setup-ruby@v1 + with: { bundler-cache: true } + + - name: Bump, commit, and tag version + id: bump_version + run: | + set -euo pipefail + + case "${{ github.event.inputs.version_bump }}" in + patch) + bin/bump_version --patch + ;; + minor) + bin/bump_version + ;; + major) + bin/bump_version --major + ;; + esac + + # The bump script builds a gem into pkg/; keep repo history source-only. + rm -f pkg/*.gem + + version="$(ruby -e "require './lib/rolemodel/version'; puts Rolemodel::VERSION")" + tag_name="v${version}" + + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + + git add lib/rolemodel/version.rb Gemfile.lock example_rails_legacy/Gemfile.lock + git commit -m "${tag_name}" + git tag "${tag_name}" + + git push origin "HEAD:${GITHUB_REF_NAME}" + git push origin "${tag_name}" + + echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT" + + - name: Create GitHub release + run: | + tag_name='${{ steps.bump_version.outputs.tag_name }}' + gh release create "${tag_name}" --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ed8ae9d7f403e9559b54cc44e11e8cfb86f9c666 Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Fri, 27 Mar 2026 12:46:23 -0500 Subject: [PATCH 3/5] Rethink workflow structure --- .github/pull_request_template.md | 5 +++- .github/workflows/bump_version.yml | 43 +++++------------------------- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 24 ++++++++++------- bin/bump_version | 4 --- 5 files changed, 27 insertions(+), 51 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ec05db10..4aa0198f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,7 +12,10 @@ What changed in this PR? ## Pre-merge checklist * [ ] Update relevant READMEs -* [ ] Run `bin/bump_version` or `bin/bump_version --patch` + +## Notes + +Please don't commit version changes within your PR. Versioning is managed through the Github Workflow. ## Screenshots diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml index aa2c6d0f..85701fe5 100644 --- a/.github/workflows/bump_version.yml +++ b/.github/workflows/bump_version.yml @@ -3,14 +3,13 @@ name: Bump Version & Publish a Github Release on: workflow_dispatch: inputs: - version_bump: - description: SemVer Bump Type - required: true + bump-type: + description: SemVer Bump Type (minor by default) + required: false type: choice options: - - patch - - minor - - major + - --patch + - --major permissions: contents: write @@ -18,11 +17,6 @@ permissions: jobs: push: runs-on: ubuntu-latest - - permissions: - contents: write - id-token: write - steps: - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 @@ -32,21 +26,7 @@ jobs: id: bump_version run: | set -euo pipefail - - case "${{ github.event.inputs.version_bump }}" in - patch) - bin/bump_version --patch - ;; - minor) - bin/bump_version - ;; - major) - bin/bump_version --major - ;; - esac - - # The bump script builds a gem into pkg/; keep repo history source-only. - rm -f pkg/*.gem + bin/bump_version ${{ github.event.inputs.bump-type }} version="$(ruby -e "require './lib/rolemodel/version'; puts Rolemodel::VERSION")" tag_name="v${version}" @@ -54,18 +34,9 @@ jobs: git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git add lib/rolemodel/version.rb Gemfile.lock example_rails_legacy/Gemfile.lock + git add . git commit -m "${tag_name}" - git tag "${tag_name}" git push origin "HEAD:${GITHUB_REF_NAME}" - git push origin "${tag_name}" echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT" - - - name: Create GitHub release - run: | - tag_name='${{ steps.bump_version.outputs.tag_name }}' - gh release create "${tag_name}" --generate-notes - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cac899a4..78e2d1ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ concurrency: jobs: run_specs: name: Rspec - runs-on: blacksmith-4vcpu-ubuntu-2404 + runs-on: ubuntu-latest timeout-minutes: 10 env: CI: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c89509d7..cd56c91d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,20 +1,26 @@ -name: Publish gem to rubygems.org +name: Create GitHub Release & Publish gem to rubygems.org on: - release: - types: [published] + push: + tags: + - 'v*' permissions: - contents: read + contents: write + id-token: write jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Create GitHub release + run: | + tag_name="$(git describe --tags --abbrev=0)" + gh release create "${tag_name}" --verify-tag --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} push: runs-on: ubuntu-latest - - permissions: - contents: write - id-token: write - steps: - uses: actions/checkout@v6 with: { persist-credentials: false } diff --git a/bin/bump_version b/bin/bump_version index b5f991e2..5e1433ac 100755 --- a/bin/bump_version +++ b/bin/bump_version @@ -24,10 +24,6 @@ class VersionBumper < Thor::Group run_clean_bundle_install end - def build_gem - run 'gem build rolemodel-rails.gemspec' - end - def update_current_example_app Rake::FileList.new('example_rails_*').each do |example_path| inside(example_path) do From be626a4c74dd76c25ac6fb71803787a10ffd80b6 Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Fri, 27 Mar 2026 12:57:59 -0500 Subject: [PATCH 4/5] add checkout step to release job --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd56c91d..3fe2467d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: release: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v6 - name: Create GitHub release run: | tag_name="$(git describe --tags --abbrev=0)" From ab3cf938e79aa02cc9c66b2a3ceb9127334701be Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Fri, 27 Mar 2026 13:00:08 -0500 Subject: [PATCH 5/5] copilot suggestions --- .github/pull_request_template.md | 2 +- .github/workflows/bump_version.yml | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4aa0198f..a84d4c09 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -15,7 +15,7 @@ What changed in this PR? ## Notes -Please don't commit version changes within your PR. Versioning is managed through the Github Workflow. +Please don't commit version changes within your PR. Versioning is managed through the GitHub Workflow. ## Screenshots diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml index 85701fe5..031e1b8f 100644 --- a/.github/workflows/bump_version.yml +++ b/.github/workflows/bump_version.yml @@ -1,4 +1,4 @@ -name: Bump Version & Publish a Github Release +name: Bump Version & Publish a GitHub Release on: workflow_dispatch: @@ -26,7 +26,7 @@ jobs: id: bump_version run: | set -euo pipefail - bin/bump_version ${{ github.event.inputs.bump-type }} + bin/bump_version ${{ github.event.inputs['bump-type'] }} version="$(ruby -e "require './lib/rolemodel/version'; puts Rolemodel::VERSION")" tag_name="v${version}" @@ -36,7 +36,6 @@ jobs: git add . git commit -m "${tag_name}" + git tag "${tag_name}" - git push origin "HEAD:${GITHUB_REF_NAME}" - - echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT" + git push origin "HEAD:${GITHUB_REF_NAME}" --follow-tags