1
1
name : Release Plugin
2
+ run-name : Release ${{ inputs.release_version }}
2
3
3
4
# Only one job at a time
4
5
concurrency : release
14
15
- ' true'
15
16
- ' false'
16
17
default : ' false'
18
+ release_version :
19
+ description : ' Release version'
20
+ required : true
21
+ type : string
17
22
18
23
jobs :
19
24
# Prepare and publish the plugin to JetBrains Marketplace repository
20
25
release :
21
- if : ${{ inputs.publishToMarketPlace == 'true' }}
22
- name : Publish to Marketplace
26
+ name : Publish new release
23
27
runs-on : ubuntu-latest
24
28
permissions :
25
29
contents : write
29
33
- name : Fetch Sources
30
34
uses : actions/checkout@v4
31
35
32
- # Validate Wrapper before running build
33
- - name : validate Gradle Wrapper
34
- uses : gradle/actions/wrapper-validation@6cec5d49d4d6d4bb982fbed7047db31ea6d38f11 # v3.3.0
35
-
36
36
# Set up Java environment for the next steps
37
37
- name : Setup Java
38
38
uses : actions/setup-java@v4
@@ -42,21 +42,25 @@ jobs:
42
42
43
43
# Setup Gradle
44
44
- name : Setup Gradle
45
- uses : gradle/actions/setup-gradle@6cec5d49d4d6d4bb982fbed7047db31ea6d38f11 # v3.3.0
45
+ uses : gradle/actions/setup-gradle@750cdda3edd6d51b7fdfc069d2e2818cf3c44f4c # v3.3.1
46
46
with :
47
+ add-job-summary : ' on-failure'
48
+ add-job-summary-as-pr-comment : ' on-failure'
49
+ validate-wrappers : true
47
50
gradle-home-cache-cleanup : true
48
51
49
52
- name : Set Release Version
50
53
shell : bash
51
54
run : |
52
55
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
53
- NEW_VERSION=${CURRENT_VERSION%-SNAPSHOT }
56
+ NEW_VERSION=${{ inputs.release_version }}.${{ github.run_number } }
54
57
awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "projectVersion" { $2 = new }1' gradle.properties > tmpfile && mv tmpfile gradle.properties
55
58
echo "Release version: $NEW_VERSION"
56
59
echo "PLUGIN_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
57
60
58
61
# Publish the plugin to JetBrains Marketplace
59
62
- name : Publish Plugin to JetBrains Marketplace
63
+ if : ${{ inputs.publishToMarketPlace == 'true' }}
60
64
env :
61
65
PUBLISH_TOKEN : ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}
62
66
run : |
@@ -72,10 +76,10 @@ jobs:
72
76
if git diff --quiet; then
73
77
echo "No changes to commit."
74
78
else
75
- git commit -sam "chore(skip-release): set version to $PLUGIN_VERSION "
79
+ git commit -sam "chore(skip-release): set version to ${{ inputs.release_version }} "
76
80
fi
77
- git tag $PLUGIN_VERSION
78
- git push origin $PLUGIN_VERSION
81
+ git tag ${{ inputs.release_version }}
82
+ git push origin ${{ inputs.release_version }}
79
83
80
84
# Set next SNAPSHOT version
81
85
- name : Increment Plugin Version
@@ -100,22 +104,23 @@ jobs:
100
104
id : changelog
101
105
with :
102
106
token : ${{ secrets.GITHUB_TOKEN }}
103
- current-tag : ${{env.PLUGIN_VERSION }}
107
+ current-tag : ${{ inputs.release_version }}
104
108
types-mapping : ' feat:Features,fix:Bug Fixes,docs:Documentation,refactor:Refactoring,build:Builds,chore:Other'
105
109
106
110
# Create a new Github release
107
111
- name : Create Github Release
108
112
env :
109
113
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110
114
run : |
111
- gh release create ${PLUGIN_VERSION } \
112
- --title "${PLUGIN_VERSION }" \
115
+ gh release create ${{ inputs.release_version } } \
116
+ --title "${{ inputs.release_version } }" \
113
117
--notes "$(cat << 'EOM'
114
118
${{ steps.changelog.outputs.changelog }}
115
119
EOM
116
120
)"
117
121
118
122
- name : Upload Release Asset
123
+ if : ${{ inputs.publishToMarketPlace == 'true' }}
119
124
env :
120
125
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
121
- run : gh release upload ${PLUGIN_VERSION } ./build/distributions/*
126
+ run : gh release upload ${{ inputs.release_version } } ./build/distributions/*
0 commit comments