Skip to content
name: Create major and minor tags for action
on:
release:
types: [published]
jobs:
tags:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tags.outputs.tags }}
steps:
- name: Compile tag list
id: tags
run: |
TAG=${GITHUB_REF/refs\/tags\//}
MAJOR="v$(echo ${TAG} | cut -d. -f1)"
MINOR="${MAJOR}.$(echo ${GITHUB_REF} | cut -d. -f2)"
EOF="$(uuidgen)"
echo "tags<<${EOF}" >> $GITHUB_OUTPUT
echo "${MAJOR}" >> $GITHUB_OUTPUT
echo "${MINOR}" >> $GITHUB_OUTPUT
echo "${EOF}" >> $GITHUB_OUTPUT
update-tags:
runs-on: ubuntu-latest
needs: [tags]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update tags
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
ORIGINAL_TAG: ${{ github.ref }}
TAGS: ${{ needs.tags.outputs.tags }}
run: |
ORIGINAL_TAG=${ORIGINAL_TAG/refs\/tags\//}
for TAG in ${TAGS};do
echo "Creating and pushing ${TAG}"
git tag -f ${TAG} ${ORIGINAL_TAG}
git push -f origin ${TAG}
done