Git tag #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v1 | |
with: | |
app-id: ${{ secrets.PUSH_O_MATIC_APP_ID }} | |
private-key: ${{ secrets.PUSH_O_MATIC_APP_KEY }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: "main" | |
fetch-depth: 0 | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Create and push new tag | |
run: | | |
tag=$(date +'%Y%m%d') | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
if [ git tag -l $tag ]; then | |
echo "Tag $tag already exists." | |
exit 1 | |
else | |
git tag $tag | |
git push origin $tag | |
fi |