Skip to content

Merge pull request #277 from xdev-software/develop #22

Merge pull request #277 from xdev-software/develop

Merge pull request #277 from xdev-software/develop #22

Workflow file for this run

name: Release
on:
push:
branches: [ master ]
permissions:
contents: write
pull-requests: write
jobs:
check_code:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Build
run: ./gradlew build buildPlugin --info --stacktrace
- 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]
timeout-minutes: 10
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@4661dc54f7b4b564074e9fbf73884d960de569a3 # 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/22113).
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]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
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]
timeout-minutes: 10
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
env:
GH_TOKEN: ${{ github.token }}
run: |
gh_pr_up() {
gh pr create "$@" || gh pr edit "$@"
}
gh_pr_up -B "develop" \
--title "Sync back" \
--body "An automated PR to sync changes back"