1
+ # GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.
2
+
3
+ name : Release
4
+ on :
5
+ release :
6
+ types : [ prereleased, released ]
7
+
8
+ jobs :
9
+
10
+ # Prepare and publish the plugin to the Marketplace repository
11
+ release :
12
+ name : Publish Plugin
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+
16
+ # Check out current repository
17
+ - name : Fetch Sources
18
+
19
+ with :
20
+ ref : ${{ github.event.release.tag_name }}
21
+
22
+ # Setup Java 21 environment for the next steps
23
+ - name : Setup Java
24
+ uses : actions/setup-java@v4
25
+ with :
26
+ distribution : zulu
27
+ java-version : 21
28
+ cache : gradle
29
+
30
+ # Set environment variables
31
+ - name : Export Properties
32
+ id : properties
33
+ shell : bash
34
+ run : |
35
+ CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
36
+ ${{ github.event.release.body }}
37
+ EOM
38
+ )"
39
+
40
+ CHANGELOG="${CHANGELOG//'%'/'%25'}"
41
+ CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
42
+ CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
43
+
44
+ echo "::set-output name=changelog::$CHANGELOG"
45
+
46
+ # Update Unreleased section with the current release note
47
+ - name : Patch Changelog
48
+ if : ${{ steps.properties.outputs.changelog != '' }}
49
+ env :
50
+ CHANGELOG : ${{ steps.properties.outputs.changelog }}
51
+ run : |
52
+ ./gradlew patchChangelog --release-note="$CHANGELOG"
53
+
54
+ # Publish the plugin to the Marketplace
55
+ # TODO - enable this step (by removing the `if` block) when JetBrains is clear about release procedures
56
+ - name : Publish Plugin
57
+ if : false
58
+ env :
59
+ PUBLISH_TOKEN : ${{ secrets.PUBLISH_TOKEN }}
60
+ CERTIFICATE_CHAIN : ${{ secrets.CERTIFICATE_CHAIN }}
61
+ PRIVATE_KEY : ${{ secrets.PRIVATE_KEY }}
62
+ PRIVATE_KEY_PASSWORD : ${{ secrets.PRIVATE_KEY_PASSWORD }}
63
+ run : ./gradlew publishPlugin --info
64
+
65
+ # Upload artifact as a release asset
66
+ - name : Upload Release Asset
67
+ env :
68
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
69
+ run : gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
70
+
71
+ # Create pull request
72
+ - name : Create Pull Request
73
+ if : ${{ steps.properties.outputs.changelog != '' }}
74
+ env :
75
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76
+ run : |
77
+ VERSION="${{ github.event.release.tag_name }}"
78
+ BRANCH="changelog-update-$VERSION"
79
+
80
+ git config user.email "[email protected] "
81
+ git config user.name "GitHub Action"
82
+
83
+ git checkout -b $BRANCH
84
+ git commit -am "Changelog update - $VERSION"
85
+ git push --set-upstream origin $BRANCH
86
+
87
+ gh pr create \
88
+ --title "Changelog update - \`$VERSION\`" \
89
+ --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
90
+ --base main \
91
+ --head $BRANCH
0 commit comments