Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version bump with workflow call #7

Open
excid3 opened this issue May 13, 2024 · 0 comments
Open

Version bump with workflow call #7

excid3 opened this issue May 13, 2024 · 0 comments

Comments

@excid3
Copy link

excid3 commented May 13, 2024

One addition that would be helpful is being able to bump the version number along with the release.

Here's an example implementation I made with GitHub Actions that accepts the version as a String input in the Actions UI on the web for reference:

name: Publish Gem
on:
  workflow_dispatch:
    inputs:
      version:
        description: "Version"
        required: true
        type: string

jobs:
  test:
    uses: ./.github/workflows/ci.yml

  push:
    needs: test
    runs-on: ubuntu-latest

    permissions:
      contents: write
      id-token: write

    steps:
      - uses: actions/checkout@v4
   
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: ruby

      - name: Update version
        run: |
          sed -i 's/".*"/"${{ inputs.version }}"/' lib/noticed/version.rb
          bundle config set --local deployment 'false'
          bundle
          bundle exec appraisal
          git config user.name 'GitHub Actions'
          git config user.email [email protected]
          git add Gemfile.lock gemfiles lib
          git commit -m "Version bump"
          git push

      - uses: rubygems/release-gem@v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant