Fix link #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [ master ] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check_code: # Validates the code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Build | |
run: ./gradlew build buildPlugin --info | |
- name: Check for uncommited changes | |
run: | | |
if [[ "$(git status --porcelain)" != "" ]]; then | |
echo ---------------------------------------- | |
echo git status | |
echo ---------------------------------------- | |
git status | |
echo ---------------------------------------- | |
echo git diff | |
echo ---------------------------------------- | |
git diff | |
echo ---------------------------------------- | |
echo Troubleshooting | |
echo ---------------------------------------- | |
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean package" | |
exit 1 | |
fi | |
prepare_release: | |
runs-on: ubuntu-latest | |
needs: [check_code] | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: UN-Snap version and output | |
id: version | |
run: | | |
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties) | |
newVersion="$(echo $originalVersion | cut -d '-' -f1)" | |
echo "New version: $newVersion" | |
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties | |
version=$newVersion | |
echo "release=$version" >> $GITHUB_OUTPUT | |
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT | |
echo "Contents of gradle.properties" | |
cat gradle.properties | |
- name: Commit and Push | |
run: | | |
git add -A | |
git commit -m "Release ${{ steps.version.outputs.release }}" | |
git push origin | |
git tag v${{ steps.version.outputs.release }} | |
git push origin --tags | |
- name: Create Release | |
id: create_release | |
uses: shogo82148/actions-create-release@v1 | |
with: | |
tag_name: v${{ steps.version.outputs.release }} | |
release_name: v${{ steps.version.outputs.release }} | |
commitish: master | |
body: | | |
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) | |
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information. | |
## Installation | |
The plugin is listed on the [Marketplace](https://plugins.jetbrains.com/plugin/23896). | |
Open the plugin Marketplace in your IDE (``File > Settings > Plugins > Marketplace``), search for the plugin and hit the install button. | |
Alternatively you can also download the jar from the marketplace website. | |
publish: | |
runs-on: ubuntu-latest | |
needs: [prepare_release] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Init Git and pull | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git pull | |
- name: Publish Plugin | |
env: | |
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_PUBLISH_TOKEN }} | |
CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_MARKETPLACE_CERTIFICATE_CHAIN }} | |
PRIVATE_KEY: ${{ secrets.JETBRAINS_MARKETPLACE_PRIVATE_KEY }} | |
PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_MARKETPLACE_PRIVATE_KEY_PASSWORD }} | |
run: ./gradlew publishPlugin --info --stacktrace | |
- name: Upload plugin files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: plugin-files | |
path: build/distributions/* | |
after_release: | |
runs-on: ubuntu-latest | |
needs: [publish] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Init Git and pull | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git pull | |
- name: Inc Version and SNAP root | |
run: | | |
originalVersion=$(grep -Po 'pluginVersion=\K.*' gradle.properties) | |
newVersion="$(echo $originalVersion | cut -d '-' -f1 | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')-SNAPSHOT" | |
echo "New version: $newVersion" | |
sed -i "s/pluginVersion=$originalVersion/pluginVersion=$newVersion/" gradle.properties | |
echo "Contents of gradle.properties" | |
cat gradle.properties | |
- name: Git Commit and Push | |
run: | | |
git add -A | |
git commit -m "Preparing for next development iteration" | |
git push origin | |
- name: pull-request | |
uses: repo-sync/pull-request@v2 | |
with: | |
destination_branch: "develop" | |
pr_title: "Sync back" | |
pr_body: "An automated PR to sync changes back" |