Automatic get latest tag #14
This file contains hidden or 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: Automatic get latest tag | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "11 0 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Get latest tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Anki | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: ankitects/anki | |
- name: Get Anki latest tag | |
id: tag | |
run: echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> "$GITHUB_OUTPUT" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- name: Get my latest tag | |
id: mytag | |
run: echo "mytag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> "$GITHUB_OUTPUT" | |
- name: Add tag | |
if: ${{ steps.tag.outputs.tag }} == ${{ steps.mytag.outputs.mytag }} | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git tag ${{ steps.tag.outputs.tag }} | |
git push origin --tags |