Publish #121
This file contains hidden or 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: Publish | |
| on: | |
| workflow_run: | |
| workflows: [ CI ] | |
| types: [ completed ] | |
| branches: [ main ] | |
| release: | |
| types: [ published ] | |
| concurrency: | |
| group: publish-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| publish: | |
| name: Publish the plugin for ${{ matrix.environmentName }} | |
| runs-on: arc-runners-large | |
| timeout-minutes: 60 | |
| if: > | |
| (github.event_name == 'release') || | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
| strategy: | |
| matrix: | |
| environmentName: | |
| - 252 | |
| - 253 | |
| - 261 | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Corretto JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version-file: '.java-version' | |
| distribution: 'corretto' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Resolve plugin version | |
| run: | | |
| BASE_VERSION=$(grep '^pluginVersion=' gradle.properties | cut -d'=' -f2) | |
| echo "VERSION=${BASE_VERSION}.${{ github.run_number }}" >> $GITHUB_ENV | |
| - name: Build plugin | |
| run: ./gradlew buildPlugin -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} | |
| - name: Upload plugin artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: HyperskillAcademy-${{ env.VERSION }}-${{ matrix.environmentName }} | |
| path: intellij-plugin/build/distributions | |
| retention-days: 3 | |
| - name: Publish plugin to Marketplace (dev channel) | |
| if: github.event_name == 'workflow_run' | |
| run: ./gradlew publishPlugin -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} | |
| env: | |
| JB_MARKETPLACE_TOKEN: ${{ secrets.JB_MARKETPLACE_TOKEN }} | |
| JB_MARKETPLACE_CHANNEL: dev | |
| - name: Publish plugin to Marketplace (stable channel) | |
| if: github.event_name == 'release' | |
| run: ./gradlew publishPlugin -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} | |
| env: | |
| JB_MARKETPLACE_TOKEN: ${{ secrets.JB_MARKETPLACE_TOKEN }} | |
| JB_MARKETPLACE_CHANNEL: "" |