Skip to content

Git tag

Git tag #64

name: Git tag
on:
workflow_dispatch:
schedule:
- cron: "0 11 * * 2"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set_tag:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.PUSH_O_MATIC_APP_CLIENT_ID }}
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }}
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: "main"
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Create and push new tag
run: |
tag=$(date +'%Y%m%d%H%M')
git config --global user.name 'GitHub Actions'
git config --global user.email 'github-actions@users.noreply.github.com'
if [ git tag -l $tag ]; then
echo "Tag $tag already exists."
exit 1
else
git tag $tag
git push origin $tag
fi