Update tag.yaml #12
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: CheckOut code | |
uses: actions/checkout@v2 | |
- name: Create tag | |
id: create_tag | |
run: | | |
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 }} |