Skip to content

Tag

Tag #217

Workflow file for this run

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Tag
permissions: { contents: read }
on:
schedule: [{ cron: '0 0 * * *' }]
push: { branches: ["main"] }
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tag:
if: github.repository_owner == 'mirceanton' # ? don't run on forks
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate Token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
with:
app-id: '${{ secrets.BOT_APP_ID }}'
private-key: '${{ secrets.BOT_APP_PRIVATE_KEY }}'
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
token: '${{ steps.app-token.outputs.token }}'
- name: Setup mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
- name: Determine tags
id: tags
run: |
CURRENT=$(mise exec -- svu current)
NEXT=$(mise exec -- svu next)
echo "current=$CURRENT" | tee -a "$GITHUB_OUTPUT"
echo "next=$NEXT" | tee -a "$GITHUB_OUTPUT"
if [ "$CURRENT" != "$NEXT" ]; then
echo "should_tag=true" | tee -a "$GITHUB_OUTPUT"
else
echo "should_tag=false" | tee -a "$GITHUB_OUTPUT"
fi
- name: Create and push tag
if: steps.tags.outputs.should_tag == 'true' && github.event_name == 'schedule'
run: |
git config user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
git config user.email "${{ steps.app-token.outputs.installation-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
git tag -a "${{ steps.tags.outputs.next }}" -m "Release ${{ steps.tags.outputs.next }}"
git push origin "${{ steps.tags.outputs.next }}"