Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Bump Version & Publish a Github Release

on:
workflow_dispatch:
inputs:
bump-type:
description: SemVer Bump Type (minor by default)
required: false
type: choice
options:
- --patch
- --major

permissions:
contents: write

jobs:
push:
runs-on: ubuntu-latest
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
bin/bump_version ${{ github.event.inputs.bump-type }}

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 .
git commit -m "${tag_name}"

git push origin "HEAD:${GITHUB_REF_NAME}"

echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Create GitHub Release & Publish gem to rubygems.org

on:
push:
tags:
- 'v*'

permissions:
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
steps:
- uses: actions/checkout@v6
with: { persist-credentials: false }
- uses: ruby/setup-ruby@v1
with: { bundler-cache: true }
- uses: rubygems/release-gem@v1
4 changes: 0 additions & 4 deletions bin/bump_version
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading