Add GH action to create tags when the version file is updated. #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}" |