From 4b88f8ca929940c21eb47ca232da0ac63228ce7c Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Mon, 12 Oct 2026 10:06:52 -0500 Subject: [PATCH] Use the shared release workflow from RoleModel/actions Replaces the bump, GitHub release, and gem publish workflows with one caller of RoleModel/actions/.github/workflows/release.yml@v3. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/bump_version.yml | 83 --------------------------- .github/workflows/publish-package.yml | 21 ------- .github/workflows/release.yml | 42 +++++++------- README.md | 2 +- 4 files changed, 22 insertions(+), 126 deletions(-) delete mode 100644 .github/workflows/bump_version.yml delete mode 100644 .github/workflows/publish-package.yml diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml deleted file mode 100644 index 9db41a2..0000000 --- a/.github/workflows/bump_version.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Bump Version - -on: - workflow_dispatch: - inputs: - bump-type: - description: SemVer Bump Type - required: false - default: minor - type: choice - options: - - patch - - minor - - major - changelog-description: - description: Changelog entry (separate bullets with $>) - required: true - type: string - -permissions: - contents: write - -concurrency: - group: ${{ github.workflow }} - -jobs: - push: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Generate app token - id: app-token - uses: actions/create-github-app-token@v3 - with: - client-id: ${{ vars.RMS_VERSION_MANAGER_CLIENT_ID }} - private-key: ${{ secrets.RMS_VERSION_MANAGER_CERT }} - - - uses: actions/checkout@v7 - with: - token: ${{ steps.app-token.outputs.token }} - - - name: Configure git identity - run: | - git config user.name '${{ steps.app-token.outputs.app-slug }}[bot]' - git config user.email '${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com' - - - name: Bump version - env: - BUMP_TYPE: ${{ inputs.bump-type }} - shell: ruby {0} - run: | - file = "lib/pop_frame/version.rb" - current = File.read(file)[/VERSION = .(.+)./, 1] - major, minor, patch = current.split(".").map(&:to_i) - version = { "major" => [major + 1, 0, 0], "minor" => [major, minor + 1, 0], "patch" => [major, minor, patch + 1] } - .fetch(ENV.fetch("BUMP_TYPE")).join(".") - - File.write(file, File.read(file).sub(current, version)) - File.write("Gemfile.lock", File.read("Gemfile.lock").gsub("pop_frame (#{current})", "pop_frame (#{version})")) - File.write(ENV.fetch("GITHUB_ENV"), "TAG=v#{version}\n", mode: "a") - - - name: Add changelog entry - env: - CHANGELOG_DESCRIPTION: ${{ inputs.changelog-description }} - shell: ruby {0} - run: | - tag = ENV.fetch("TAG") - bullets = ENV.fetch("CHANGELOG_DESCRIPTION").split(/\$>|\n/).map(&:strip).reject(&:empty?).map { "- #{_1}" } - entry = "## [#{tag}] #{Time.now.utc.strftime("%b %-d, %Y")}\n\n#{bullets.join("\n")}\n\n" - link = "[#{tag}]: #{ENV.fetch("GITHUB_SERVER_URL")}/#{ENV.fetch("GITHUB_REPOSITORY")}/releases/tag/#{tag}\n" - - changelog = File.read("CHANGELOG.md") - changelog.sub!(/^## /) { entry + _1 } - changelog.sub!(/^\[v/) { link + _1 } - File.write("CHANGELOG.md", changelog) - - - name: Commit and tag - run: | - git commit -am "$TAG" - git tag -m "$TAG" "$TAG" - - - name: Push - run: git push --atomic origin "HEAD:${GITHUB_REF_NAME}" --follow-tags diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml deleted file mode 100644 index f994c6b..0000000 --- a/.github/workflows/publish-package.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Publish New Version - -on: - release: - types: [published] - -permissions: - id-token: write - contents: write - -jobs: - gem: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v7 - with: { persist-credentials: false } - - uses: ruby/setup-ruby@v1 - with: { bundler-cache: true } - - uses: rubygems/release-gem@v1 - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56a42e6..13663cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,30 +1,30 @@ -name: Create GitHub Release +name: Release on: + workflow_dispatch: + inputs: + bump-type: + type: choice + options: [patch, minor, major] + default: minor + changelog: + description: Changelog bullets (separate with $>). Leave blank to use the Unreleased notes or draft them from the commits. + type: string push: - tags: - - "v*" + tags: ['v*'] permissions: contents: write + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && 'bump' || github.ref }} jobs: release: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Generate app token - id: app-token - uses: actions/create-github-app-token@v3 - with: - client-id: ${{ vars.RMS_VERSION_MANAGER_CLIENT_ID }} - private-key: ${{ secrets.RMS_VERSION_MANAGER_CERT }} - - - uses: actions/checkout@v7 - with: - token: ${{ steps.app-token.outputs.token }} - - - name: Create GitHub release - run: gh release create "${{ github.ref_name }}" --verify-tag --generate-notes - env: - GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + uses: RoleModel/actions/.github/workflows/release.yml@v3 + with: + bump-type: ${{ inputs.bump-type }} + changelog: ${{ inputs.changelog }} + publish-gem: true + secrets: inherit diff --git a/README.md b/README.md index 06994a8..64d4cc1 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ Lint with `bin/rubocop`. Run the dummy app's server on port 3000 with `bin/dev` (set `PORT` to change it). It's a page of popovers to try by hand. -Releases are cut from the **Bump Version** workflow in the Actions tab. It takes the version bump and +Releases are cut from the **Release** workflow in the Actions tab. It takes the version bump and a changelog entry, then tags the release, publishes it on GitHub, and pushes the gem to RubyGems. ## Acknowledgments