Skip to content

Commit

Permalink
CI: Automate release flow. (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-descope authored Apr 17, 2024
1 parent b5af94e commit 2d27c9c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/publish-gem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
pull-requests: read # to detect changes files

jobs:
publish-gem:
release:
name: Publish Ruby Gem
runs-on: ubuntu-latest
steps:
Expand All @@ -24,6 +24,28 @@ jobs:
- name: Install dependencies
run: bundle install

- name: Bump version
run: |
NEW_VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//') # strip the 'v' from the tag if present
sed -i -r "s/VERSION = \".+\"/^VERSION = \"${NEW_VERSION}\"/" ./lib/descope/version.rb
- name: Commit changes
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git commit -am "Bump version to $NEW_VERSION"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Repoint the tag to latest commit
run: |
git tag -fa ${{ github.event.release.tag_name }} -m "Release $NEW_VERSION"
git push origin :${{ github.event.release.tag_name }}
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
Expand Down

0 comments on commit 2d27c9c

Please sign in to comment.