diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..737b8f8b7 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,48 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + +concurrency: + group: ci-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + check: + name: Check the plugin for ${{ matrix.environmentName }} + runs-on: arc-runners-large + timeout-minutes: 60 + 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: Run tests + run: ./gradlew test -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} + + - name: Verify plugin + run: ./gradlew verifyPlugin -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c33abffa1..16a51488a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,21 +1,25 @@ -name: Plugin deployment +name: Publish on: - push: + workflow_run: + workflows: [ CI ] + types: [ completed ] branches: [ main ] - pull_request: release: types: [ published ] concurrency: - group: publish-plugin-${{ github.ref_name }} + group: publish-${{ github.ref_name }} cancel-in-progress: true jobs: - deploy: - name: Deploy the plugin for ${{ matrix.environmentName }} + 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: @@ -53,14 +57,8 @@ jobs: path: intellij-plugin/build/distributions retention-days: 3 - - name: Run tests - run: ./gradlew test -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} - - - name: Verify plugin - run: ./gradlew verifyPlugin -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} - - name: Publish plugin to Marketplace (dev channel) - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + if: github.event_name == 'workflow_run' run: ./gradlew publishPlugin -PenvironmentName=${{ matrix.environmentName }} -PpluginVersion=${{ env.VERSION }} env: JB_MARKETPLACE_TOKEN: ${{ secrets.JB_MARKETPLACE_TOKEN }}