1616 release :
1717 name : Publish
1818 runs-on : ubuntu-latest
19- permissions :
20- contents : write
21- pull-requests : write
19+
2220 steps :
2321 # Check out current repository
2422 - name : Fetch Sources
3634 - name : Setup Gradle
3735 uses : gradle/actions/setup-gradle@v4
3836
37+ - name : Set Release Version
38+ shell : bash
39+ run : |
40+ CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
41+ NEW_VERSION=${{ inputs.release_version }}
42+ awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "projectVersion" { $2 = new }1' gradle.properties > tmpfile && mv tmpfile gradle.properties
43+ echo "Release version: $NEW_VERSION"
44+ echo "PLUGIN_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
45+
46+ # Build plugin
47+ - name : Build Plugin
48+ run : ./gradlew assemble build
49+
3950 - name : Tag Release
4051 env :
4152 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -50,21 +61,28 @@ jobs:
5061 git tag ${{ inputs.release_version }}
5162 git push origin ${{ inputs.release_version }}
5263
53- - name : Set Release Version
54- shell : bash
55- run : |
56- CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
57- NEW_VERSION=${{ inputs.release_version }}
58- awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "projectVersion" { $2 = new }1' gradle.properties > tmpfile && mv tmpfile gradle.properties
59- echo "Release version: $NEW_VERSION"
60- echo "PLUGIN_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
64+ # Publish to Maven repo
65+ - name : Checkout Maven Repo
66+ uses : actions/checkout@v4
67+ with :
68+ ref : repository
69+ path : build/repository
6170
62- # Publish the plugin to local release repo
63- - name : Publish Library
71+ - name : Deploy to Maven Repository
72+ env :
73+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6474 run : |
75+ CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
6576 ./gradlew publish
6677 echo "Published $PLUGIN_VERSION."
6778
79+ git config --global user.email "[email protected] " 80+ git config --global user.name "GitHub Action Bot"
81+ pushd build/repository
82+ git add releases/
83+ git commit -m "Publish ${CURRENT_VERSION} (${{github.run_number}})"
84+ git push -f origin repository
85+
6886 # Set next SNAPSHOT version
6987 - name : Increment Plugin Version
7088 env :
0 commit comments