Skip to content

Quick Change to Script to test Automation #98

Quick Change to Script to test Automation

Quick Change to Script to test Automation #98

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:
# draft: true # Can uncomment this if you want to keep it a draft, but I find it more useful to auto-publish the release on each PR merge.
token: ${{ secrets.GITHUB_TOKEN }}
# name: "${{ steps.tag.outputs.tag }}: [title-edit-me] by:${{ github.actor }}" # Uncomment if you go the draft route, otherwise it defaults to the tag name (i.e. 1.67.0)
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"