Merge pull request #47 from xm-online/fix/rollback-xm-commons-version #6
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: set tags project version | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
set_tags: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Set Tag | |
run: | | |
set -e | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
version=`./gradlew -q getProjectVersion` | |
tags=$(echo -n $version | awk -F '.' '{printf $0" "$1"."$2" "$1}') | |
for tag in $tags | |
do | |
if git tag -l | egrep -q "^v"$tag"$" | |
then | |
git tag -d "v"$tag | |
fi | |
git tag -a "v"$tag -m "add tag $tag" | |
done | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true | |
force: true |