@@ -15,31 +15,40 @@ jobs:
1515 - uses : actions/checkout@v6
1616 with :
1717 ref : ${{ github.event.pull_request.base.ref }}
18+ token : ${{ secrets.PAT }}
1819 - name : Tag and Bump Snapshot
20+ env :
21+ GH_TOKEN : ${{ secrets.PAT }}
1922 run : |
2023 # Set git user
21- git config user.name "github-actions[bot] ";
22- git config user.email "actions@ github.com"
24+ git config user.name "Rollczi ";
25+ git config user.email "[email protected] . github.com" 2326
24- # Create Release tag
25- RELEASE_VERSION=$(jq -r '.versionRelease' .github/version.json)
26- git tag "v$RELEASE_VERSION" && git push origin "v$RELEASE_VERSION"
27+ # Read Release tag
28+ RELEASE_VERSION=$(jq -r '.versionRelease' .github/release/version.json)
29+
30+ # Push tag
31+ if git ls-remote --tags origin | grep -q "refs/tags/v$VERSION"; then
32+ echo "⚠️ Skipped tag"
33+ else
34+ git tag "v$VERSION" && git push origin "v$VERSION"
35+ fi
2736
2837 # Create
29- sed "s/{version}/$REL /g" .github/release- template.md > final_notes.md
30- gh release create "RELEASE_VERSION " \
31- --title "RELEASE_VERSION " \
38+ sed "s/{version}/$VERSION /g" .github/release/ template.md > final_notes.md
39+ gh release create "v$VERSION " \
40+ --title "LiteCommands $VERSION " \
3241 --notes-file final_notes.md \
3342 --generate-notes
3443
3544 # Create Snapshot version
36- IFS='.' read -ra V <<< "$RELEASE_VERSION "
45+ IFS='.' read -ra V <<< "$VERSION "
3746 NEXT_SNAPSHOT="${V[0]}.${V[1]}.$((V[2]+1))-SNAPSHOT"
3847
3948 # Update files litecommands-publish.gradle.kts (releaseVersion -> nextSnapshot)
40- sed -i "s/$RELEASE_VERSION /$NEXT_SNAPSHOT/g" buildSrc/src/main/kotlin/litecommands-publish.gradle.kts
41- jq ".versionSnapshot = \"$NEXT_SNAPSHOT\"" .github/version.json > t.json && mv t.json .github/version.json
49+ sed -i "s/$VERSION /$NEXT_SNAPSHOT/g" buildSrc/src/main/kotlin/litecommands-publish.gradle.kts
50+ jq ".versionSnapshot = \"$NEXT_SNAPSHOT\"" .github/release/ version.json > t.json && mv t.json .github/release /version.json
4251
4352 # Commit & push Snapshot
44- git commit -am "( Snapshot $NEXT_SNAPSHOT) "
53+ git commit -am "Snapshot $NEXT_SNAPSHOT"
4554 git push
0 commit comments