Skip to content

Commit 10ffbe5

Browse files
committed
add release wf
1 parent 33a18ba commit 10ffbe5

File tree

2 files changed

+73
-20
lines changed

2 files changed

+73
-20
lines changed

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Publish JetBrains Plugin
2+
3+
on:
4+
schedule:
5+
- cron: '0 12 */3 * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '17'
23+
distribution: 'jetbrains'
24+
25+
- name: Setup Gradle
26+
uses: gradle/gradle-build-action@v3
27+
28+
- name: Increment Version
29+
id: version
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
# Access current version from gradle.properties
34+
CURRENT_VERSION=$(grep "pluginVersion=" gradle.properties | cut -d'=' -f2)
35+
36+
# Splitting version
37+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
38+
39+
NEW_PATCH=$((PATCH + 1))
40+
NEW_VERSION="${MAJOR}.${MINOR}.${NEW_PATCH}"
41+
42+
# Replace original pluginVersion в gradle.properties
43+
sed -i -e "s/pluginVersion=.*/pluginVersion=${NEW_VERSION}/g" gradle.properties
44+
45+
# Export version number
46+
echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT"
47+
48+
- name: Create .env file
49+
run: |
50+
echo "PUBLISH_TOKEN=${{ secrets.JETBRAINS_PUBLISH_TOKEN }}" > .env
51+
52+
- name: Publish Plugin
53+
env:
54+
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
55+
run: |
56+
./gradlew publishPlugin
57+
58+
- name: Commit and push changes
59+
uses: EndBug/add-and-commit@v9
60+
with:
61+
add: 'gradle.properties'
62+
author_name: GitHub Actions
63+
author_email: actions@github.com
64+
message: "Bump version to ${{ steps.version.outputs.version }}"
65+
tag: "v${{ steps.version.outputs.version }}"
66+
67+
- name: Create GitHub Release
68+
uses: softprops/action-gh-release@v2
69+
with:
70+
tag_name: v${{ steps.version.outputs.version }}
71+
generate_release_notes: true
72+
files:
73+
build/distributions/gitattributes-${{ steps.version.outputs.version }}.zip

build.gradle.kts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,6 @@ intellijPlatform {
9292
}
9393
}
9494

95-
val changelog = project.changelog // local variable for configuration cache compatibility
96-
// Get the latest available change notes from the changelog file
97-
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
98-
with(changelog) {
99-
renderItem(
100-
(getOrNull(pluginVersion) ?: getUnreleased())
101-
.withHeader(false)
102-
.withEmptySections(false),
103-
Changelog.OutputType.HTML,
104-
)
105-
}
106-
}
107-
10895
ideaVersion {
10996
sinceBuild = providers.gradleProperty("pluginSinceBuild")
11097
untilBuild = providers.gradleProperty("pluginUntilBuild")
@@ -132,12 +119,6 @@ intellijPlatform {
132119
}
133120
}
134121

135-
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
136-
changelog {
137-
groups.empty()
138-
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
139-
}
140-
141122
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
142123
kover {
143124
reports {
@@ -155,7 +136,6 @@ tasks {
155136
}
156137

157138
publishPlugin {
158-
dependsOn(patchChangelog)
159139
}
160140

161141
// https://plugins.jetbrains.com/docs/marketplace/obfuscate-the-plugin.html#proguard

0 commit comments

Comments
 (0)