Skip to content

Fix Auto Releases

Fix Auto Releases #99

Workflow file for this run

name: Bump version
on:
pull_request_target:
types:
- closed
branches:
- master
paths:
- "entrypoint.sh"
- "action.yml"
- "Dockerfile"
jobs:
bump-version:
if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: version-tag
id: tag
uses: anothrNick/github-tag-action@master # if we use 1 there is a too-be-fixed bug https://github.com/anothrNick/github-tag-action/actions/runs/3139501775/jobs/5099976842#step:1:35 as alternative we could use v1
env:
VERBOSE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_API_TAGGING: false # uses git cli
- name: automatic-release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.tag.outputs.new_tag }}
generate_release_notes: true
prerelease: false
- name: version-tag-major
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch --tags
tagFmt="^v?[0-9]+\.[0-9]+\.[0-9]+$"
tag="$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)' | grep -E "$tagFmt" | head -n 1)"
[[ "$tag" =~ ^([0-9]+) ]] # use ^(v[0-9]+) for vX
major=${BASH_REMATCH[1]}
# update major tag
git tag -f "$major"
git push -f origin "$major"
# add vX as 1 is linked to short sha bug https://github.com/anothrNick/github-tag-action/actions/runs/3139501775/jobs/5099976842#step:1:35
git tag -f "v$major"
git push -f origin "v$major"