File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 push :
44 branches :
55 - main
6+
7+ permissions :
8+ contents : write
9+ pages : write
10+ id-token : write
11+
612jobs :
713 publish-jar :
814 runs-on : ubuntu-latest
1117 uses : actions/checkout@v4
1218 with :
1319 token : ${{ secrets.GITHUB_TOKEN }}
20+ fetch-depth : 0
1421
1522 - name : Set up JDK 17
1623 uses : actions/setup-java@v4
2835 echo "version=$VERSION" >> $GITHUB_OUTPUT
2936 echo "Extracted version: $VERSION"
3037
38+ - name : Check if tag already exists
39+ id : check_tag
40+ run : |
41+ if git tag -l "${{ steps.extract_version.outputs.version }}" | grep -q "${{ steps.extract_version.outputs.version }}"; then
42+ echo "tag_exists=true" >> $GITHUB_OUTPUT
43+ echo "Tag ${{ steps.extract_version.outputs.version }} already exists"
44+ else
45+ echo "tag_exists=false" >> $GITHUB_OUTPUT
46+ echo "Tag ${{ steps.extract_version.outputs.version }} does not exist"
47+ fi
48+
3149 - name : Publish Maven artifacts to local repo
3250 run : ./gradlew publish
3351 env :
@@ -44,14 +62,11 @@ jobs:
4462 folder : build/repo
4563 target-folder : connectorapi/jar
4664
47- - name : Configure Git for tagging
65+ - name : Create and push Git tag
66+ if : steps.check_tag.outputs.tag_exists == 'false'
4867 run : |
4968 git config --local user.email "action@github.com"
5069 git config --local user.name "GitHub Action"
51- git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
52-
53- - name : Create and push Git tag
54- run : |
5570 git tag -a "${{ steps.extract_version.outputs.version }}" -m "Release version ${{ steps.extract_version.outputs.version }}"
5671 git push origin "${{ steps.extract_version.outputs.version }}"
5772 env :
You can’t perform that action at this time.
0 commit comments