16
16
release :
17
17
name : Publish
18
18
runs-on : ubuntu-latest
19
- permissions :
20
- contents : write
21
- pull-requests : write
19
+
22
20
steps :
23
21
# Check out current repository
24
22
- name : Fetch Sources
36
34
- name : Setup Gradle
37
35
uses : gradle/actions/setup-gradle@v4
38
36
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
+
39
50
- name : Tag Release
40
51
env :
41
52
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -50,21 +61,28 @@ jobs:
50
61
git tag ${{ inputs.release_version }}
51
62
git push origin ${{ inputs.release_version }}
52
63
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
61
70
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 }}
64
74
run : |
75
+ CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
65
76
./gradlew publish
66
77
echo "Published $PLUGIN_VERSION."
67
78
79
+ git config --global user.email "action@github.com"
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
+
68
86
# Set next SNAPSHOT version
69
87
- name : Increment Plugin Version
70
88
env :
0 commit comments