Skip to content

Commit

Permalink
automatically publish GitHub release and to JetBrains Marketplace whe…
Browse files Browse the repository at this point in the history
…n new version tag is pushed. (#9)

automatically publish GitHub release and to JetBrains Marketplace when new version tag is pushed
  • Loading branch information
stepanvalyavskiy committed Mar 26, 2024
1 parent ca804fc commit 4414b22
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions .github/workflows/github-actions-CI.yml
@@ -1,9 +1,20 @@
name: CI
on: [push, pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "v*"

jobs:
build:
ci:
name: test
runs-on: ubuntu-latest
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH }}

steps:
- name: Checkout repository
Expand All @@ -20,3 +31,42 @@ jobs:

- 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


0 comments on commit 4414b22

Please sign in to comment.