Release #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }}-release | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
jobs: | |
ensure_main_branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if running on main branch | |
run: | | |
if [ "${GITHUB_REF}" != "refs/heads/main" ]; then | |
echo "This workflow can only be run from the main branch." | |
exit 1 | |
fi | |
lint: | |
needs: [ensure_main_branch] | |
permissions: | |
checks: write | |
contents: write | |
uses: ./.github/workflows/lint.yml | |
test: | |
permissions: | |
contents: read | |
checks: write | |
needs: [ensure_main_branch] | |
uses: ./.github/workflows/test.yml | |
version: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
env: | |
BUNDLE_ONLY: versioning | |
needs: [lint, test] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Set up Ruby | |
uses: ruby/[email protected] | |
with: | |
ruby-version: 3.2.2 | |
bundler-cache: true | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v42 | |
with: | |
files: "lib/active_cached_resource/version.rb" | |
- name: Bump Patch Version | |
id: semver | |
if: steps.changed-files.outputs.any_changed == 'false' | |
run: | | |
bundle exec bump patch --no-commit | |
echo "semver=$(bundle exec bump current)" >> $GITHUB_OUTPUT | |
- name: Commit Version Bump | |
if: steps.changed-files.outputs.any_changed == 'false' | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "lib/active_cached_resource/version.rb" | |
default_author: github_actions | |
message: "Bump version to ${{ steps.semver.outputs.semver }}" | |
release: | |
name: Release gem to RubyGems.org | |
needs: [version] | |
runs-on: ubuntu-latest | |
env: | |
BUNDLE_WITHOUT: 'versioning:development:test' | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Set up Ruby | |
uses: ruby/[email protected] | |
with: | |
ruby-version: 3.2.2 | |
bundler-cache: true | |
- name: Update RubyGems | |
run: gem update --system | |
- uses: rubygems/release-gem@v1 |