Update tag.yaml #10
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: tag | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: version-tag | |
id: tag | |
uses: anothrNick/github-tag-action@master # if we use 1 there is a too-be-fixed bug https://github.com/anothrNick/github-tag-action/actions/runs/3139501775/jobs/5099976842#step:1:35 as alternative we could use v1 | |
env: | |
VERBOSE: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_API_TAGGING: false # uses git cli | |
- name: Create tag | |
id: create_tag | |
run: | | |
echo "tag: ${{ steps.tag.outputs.tag }}" | |
git fetch --tags | |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
echo "Latest tag: $latest_tag" | |
first=$(echo "$latest_tag" | cut -d '.' -f 1) | |
mid=$(echo "$latest_tag" | cut -d '.' -f 2) | |
last=$(echo "$latest_tag" | cut -d '.' -f 3) | |
mid=$((10#$mid)) | |
last=$((10#$last)) | |
if [ "$last" -ge 9 ]; then | |
mid=$((mid + 1)) | |
last=1 | |
else | |
last=$(( last+1 )) | |
fi | |
new_tag="${first}.$mid.$last" | |
echo "New tag: $new_tag" | |
echo "::set-output name=new_tag::$new_tag" | |
- name: Tag check | |
run: | | |
echo "${{ steps.create_tag.outputs.new_tag }}" | |
- name: Tag commit | |
uses: tvdias/[email protected] | |
with: | |
repo-token: "${{ secrets.user_token }}" | |
tag: ${{ steps.create_tag.outputs.new_tag }} |