Skip to content

Commit 709f975

Browse files
committed
add auto-tag release workflow github action
1 parent 64e28c9 commit 709f975

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.github/workflows/tag.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Tag Release
2+
3+
env:
4+
GEM_NAME: query_packwerk
5+
GEM_CLASS_NAME: QueryPackwerk
6+
7+
on:
8+
pull_request:
9+
types: [closed]
10+
branches: [main]
11+
12+
jobs:
13+
release:
14+
if: github.event.pull_request.merged == true
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: 3.2
23+
24+
- name: Determine release type
25+
id: version
26+
run: |
27+
if [[ "${{ github.event.pull_request.labels[*] }}" == *"major"* ]]; then
28+
echo "bump=major" >> $GITHUB_OUTPUT
29+
elif [[ "${{ github.event.pull_request.labels[*] }}" == *"minor"* ]]; then
30+
echo "bump=minor" >> $GITHUB_OUTPUT
31+
else
32+
echo "bump=patch" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Bump version
36+
run: |
37+
gem install bump
38+
bump ${{ steps.version.outputs.bump }}
39+
40+
- name: Commit and tag version bump
41+
run: |
42+
git config user.name "github-actions"
43+
git config user.email "[email protected]"
44+
git commit -am "Bump version"
45+
VERSION=$(ruby -e "require './lib/${{ env.GEM_NAME }}/version'; puts ${{ env.GEM_CLASS_NAME }}::VERSION")
46+
git tag "v$VERSION"
47+
git push --follow-tags

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ GEM
6767
crass (~> 1.0.2)
6868
nokogiri (>= 1.12.0)
6969
method_source (1.1.0)
70-
mini_portile2 (2.8.8)
70+
mini_portile2 (2.8.9)
7171
minitest (5.25.5)
7272
netrc (0.11.0)
7373
nokogiri (1.18.5)

0 commit comments

Comments
 (0)