39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
name: Update publish tag
|
|
description: Moves the corresponding tag to the current commit
|
|
author: Skydust
|
|
|
|
inputs:
|
|
tag:
|
|
description: The tag to create/move
|
|
required: false
|
|
default: "production"
|
|
token:
|
|
description: 'A Gitea PAT'
|
|
default: "${{ secrets.CI_TOKEN }}"
|
|
required: false
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Moving/Creating tag
|
|
run: |
|
|
TAG_TO_CREATE="${{ inputs.tag }}"
|
|
|
|
git fetch origin tag "${TAG_TO_CREATE}" || NO_TAG_ON_REPO=yes
|
|
|
|
if git tag --points-at HEAD | grep -q "^${TAG_TO_CREATE}"; then
|
|
log_info "$(green)${TAG_TO_CREATE} already on current commit"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ -n "${NO_TAG_ON_REPO}"]]; then
|
|
log_info "$(yellow)No ${TAG_TO_CREATE} tag on repo"
|
|
else
|
|
git push origin --delete "${TAG_TO_CREATE}"
|
|
log_info "$(yellow)Removed ${TAG_TO_CREATE} tag from repo"
|
|
fi
|
|
|
|
git tag "${TAG_TO_CREATE}" HEAD
|
|
git push origin "${TAG_TO_CREATE}" --force
|
|
log_info "$(green)${TAG_TO_CREATE} created successfully"
|