Skip to content

automatically publish GitHub release and to JetBrains Marketplace when new version tag is pushed. #24

automatically publish GitHub release and to JetBrains Marketplace when new version tag is pushed.

automatically publish GitHub release and to JetBrains Marketplace when new version tag is pushed. #24

name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "v*"
jobs:
ci:
name: test
runs-on: ubuntu-latest
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Build plugin
run: ./gradlew build
- name: Run tests
run: ./gradlew test
- name: Has to be published?
id: is-release
if: startsWith(github.ref, 'refs/tags/v')
run: |
version="$GITHUB_REF_NAME"
version_number="${version:1}"
zip="./build/distributions/Decorate.me-${version_number}.zip"
echo "New version $version_number has to be published"
echo "ZIP_PATH=$zip" >> $GITHUB_OUTPUT
echo "VERSION_NUMBER=$version_number" >> $GITHUB_OUTPUT
- name: Assembles a plugin and prepares ZIP archive for deployment
if: startsWith(github.ref, 'refs/tags/v')
run: ./gradlew buildPlugin
- name: Check version
if: startsWith(github.ref, 'refs/tags/v')
run: |
if [ ! -f "${{steps.is-release.outputs.ZIP_PATH}}" ]; then
echo "Error: Wrong release version! Check if your tag matches with an actual version in build.gradle.kts"
echo "provided tag's version: ${{ steps.is-release.outputs.VERSION_NUMBER }}"
echo "${{ steps.is-release.outputs.ZIP_PATH }} expected to be generated"
echo "but actual was:"
ls ./build/distributions
exit 1
fi
- name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.is-release.outputs.ZIP_PATH }}
- name: Publish Plugin to JetBrains Marketplace
if: startsWith(github.ref, 'refs/tags/v')
run: ./gradlew publishPlugin