Skip to content

Fixes #309

Fixes #309 #95

Workflow file for this run

name: Bump version
on:
pull_request:
types:
- closed
branches:
- master
paths:
- 'entrypoint.sh'
- 'action.yml'
- 'Dockerfile'
jobs:
bump-version:
if: github.event_name == 'pull_request' && 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
# auto releases is not working atm and is deleting releases due branch tags
- name: automatic-draft-release
uses: marvinpinto/[email protected]
with:
draft: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
title: "${{ steps.tag.outputs.tag }}: [title-edit-me] by:${{ github.actor }}"
automatic_release_tag: ${{ steps.tag.outputs.new_tag }}
- 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"