Skip to content

Commit

Permalink
Add GH action to create tags when the version file is updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Jan 9, 2025
1 parent 959f01a commit 89db218
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/tag_on_version_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tag

on:
pull_request:
branches:
- main
paths:
- "internal/version/version.go"
types:
- closed
push:

jobs:
new_tag:
# if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Bump version and push tag
id: check
uses: anothrNick/[email protected]
env:
DRY_RUN: true
DEFAULT_BUMP: patch

- name: check tag
id: version
run: |
echo "in_file=$(cat internal/version/version.go | grep "^var Version = " | cut -d ' ' -f4 | tr -d "\"")" >> $GITHUB_OUTPUT
- uses: jackbilestech/[email protected]
id: compare
with:
head: ${{steps.version.outputs.in_file}}
base: ${{steps.check.outputs.old_tag}}
operator: '>'

- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_TAG: "V${{steps.version.outputs.in_file}}"

0 comments on commit 89db218

Please sign in to comment.