name: "New plugin release"
on:
  push:
    tags:
      - v[0-9]+.[0-9]+.[0-9]+

jobs:
  make-new-release:
    if: github.event.base_ref == 'refs/heads/master'
    name: "Releasing plugin"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Restore Gradle caches
        uses: actions/cache@v1
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
          restore-keys: |
            ${{ runner.os }}-gradle-cache-
      - name: Restore Gradle wrapper
        uses: actions/cache@v1
        with:
          path: ~/.gradle/wrapper
          key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
          restore-keys: |
            ${{ runner.os }}-gradle-wrapper-
      - name: Publish plugin
        env:
          GRADLE_PUBLISH_KEY: {{ secrets.GRADLE_PUBLISH_KEY }}
          GRADLE_PUBLISH_SECRET: {{ secrets.GRADLE_PUBLISH_SECRET }}
          GITHUB_KEY: {{ secrets.GithubKey }}
        run: ./plugin/gradlew -p ./plugin publishPlugins --no-daemon
      - name: Create new Github release
        env:
          GRADLE_PUBLISH_KEY: { { secrets.GRADLE_PUBLISH_KEY } }
          GRADLE_PUBLISH_SECRET: { { secrets.GRADLE_PUBLISH_SECRET } }
          GITHUB_KEY: { { secrets.GithubKey } }
        run: ./plugin/gradlew -p ./plugin githubRelease --no-daemon

Migrate to Github action plugin publishing.
Migrate to Github action plugin publishing.

Signed-off-by: Yahor Berdnikau <65de286607a8090de37d6bb23a427517fd3c474e@gmail.com>
