Skip to content

Commit 80e7dfc

Browse files
authored
Merge pull request #66 from aws/ilbe/auto-tag-on-version-bump
ci: auto-tag on version bump merge
2 parents 7ae6e6c + 3c68ee6 commit 80e7dfc

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎.github/workflows/tag-version.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Tag version on merge
2+
on:
3+
push:
4+
branches: [main]
5+
paths: ['lib/aws_lambda_ric/version.rb']
6+
7+
jobs:
8+
tag:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
steps:
13+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
14+
15+
- name: Check version
16+
id: check
17+
run: |
18+
VERSION=$(ruby -e "require './lib/aws_lambda_ric/version'; puts AwsLambdaRIC::VERSION")
19+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
20+
if git rev-parse "refs/tags/$VERSION" >/dev/null 2>&1; then
21+
echo "tag_exists=true" >> "$GITHUB_OUTPUT"
22+
else
23+
echo "tag_exists=false" >> "$GITHUB_OUTPUT"
24+
fi
25+
26+
- name: Create tag
27+
if: steps.check.outputs.tag_exists == 'false'
28+
run: |
29+
git tag ${{ steps.check.outputs.version }}
30+
git push origin ${{ steps.check.outputs.version }}

0 commit comments

Comments
 (0)