-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (61 loc) · 2.1 KB
/
release.yml
File metadata and controls
71 lines (61 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Tag and Release Gem
env:
GEM_NAME: query_packwerk
GEM_CLASS_NAME: QueryPackwerk
on:
pull_request:
types: [closed]
branches: [main]
permissions:
contents: write
actions: read
jobs:
tag:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- name: Determine release type
id: version
run: |
if [[ "${{ github.event.pull_request.labels[*] }}" == *"major"* ]]; then
echo "bump=major" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.pull_request.labels[*] }}" == *"minor"* ]]; then
echo "bump=minor" >> $GITHUB_OUTPUT
else
echo "bump=patch" >> $GITHUB_OUTPUT
fi
- name: Bump version
run: |
gem install bump
bump ${{ steps.version.outputs.bump }}
- name: Commit and tag version bump
run: |
# Attribute commits to the last committer on HEAD
git config --global user.email "$(git log -1 --pretty=format:'%ae')"
git config --global user.name "$(git log -1 --pretty=format:'%an')"
git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY"
VERSION=$(ruby -e "require './lib/${{ env.GEM_NAME }}/version'; puts ${{ env.GEM_CLASS_NAME }}::VERSION")
git commit -am "Bump version to $VERSION"
git tag "v$VERSION"
git push origin main "v$VERSION"
release:
if: github.repository == 'rubyatscale/query_packwerk'
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0
with:
bundler-cache: true
ruby-version: ruby
# Release
- uses: rubygems/release-gem@e9a6361a0b14562539327c2a02373edc56dd3169 # v1