IntelliJ Plugin 2.0 #223
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: Build & Release | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] | |
| pull_request: | |
| branches: [ main ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Run tests, analysis and coverage first; build/publish proceed only if this passes | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Free GitHub Actions Environment Disk Space | |
| - name: Maximize Build Space | |
| # jlumbroso/free-disk-space@v1.3.1: | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
| with: | |
| tool-cache: false | |
| large-packages: false | |
| # Check out the current repository | |
| - name: Fetch Sources | |
| uses: actions/checkout@v6 | |
| # Validate wrapper | |
| - name: Gradle Wrapper Validation | |
| uses: gradle/actions/wrapper-validation@v6 | |
| # Set up Java environment for the next steps | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| # Setup Gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| # Gradle permission | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # Run test suite | |
| - name: Run tests | |
| run: ./gradlew test | |
| analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| - name: Run code analysis | |
| run: ./gradlew detekt --stacktrace | |
| shell: bash | |
| - name: Upload SARIF file | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: build/reports/detekt/detekt.sarif | |
| - name: Upload analysis report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: analysis-report | |
| path: build/reports/detekt | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| - name: Calculate coverage | |
| run: ./gradlew koverXmlReport --stacktrace | |
| shell: bash | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-report | |
| path: build/reports/kover | |
| upload-reports: | |
| needs: [ test, analysis, coverage ] | |
| runs-on: ubuntu-latest | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BUILD_NUMBER: ${{ github.run_number }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 17 | |
| distribution: zulu | |
| - name: SonarCloud cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Download coverage report | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: coverage-report | |
| - name: Download analysis report | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: analysis-report | |
| - name: Upload reports to SonarCloud | |
| run: ./gradlew sonar --stacktrace | |
| shell: bash | |
| # Prepare environment and build the plugin | |
| build: | |
| name: Build | |
| needs: [ test, analysis, coverage ] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.properties.outputs.version }} | |
| changelog: ${{ steps.properties.outputs.changelog }} | |
| pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} | |
| steps: | |
| # Free GitHub Actions Environment Disk Space | |
| - name: Maximize Build Space | |
| # jlumbroso/free-disk-space@v1.3.1: | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
| with: | |
| tool-cache: false | |
| large-packages: false | |
| # Check out the current repository | |
| - name: Fetch Sources | |
| uses: actions/checkout@v7 | |
| # Validate wrapper | |
| - name: Gradle Wrapper Validation | |
| uses: gradle/actions/wrapper-validation@v6.2.0 | |
| # Set up Java environment for the next steps | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| # Setup Gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6.2.0 | |
| # Gradle permission | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # Set environment variables | |
| - name: Export Properties | |
| id: properties | |
| shell: bash | |
| run: echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT | |
| # Build plugin | |
| - name: Build plugin | |
| # buildPlugin depends on npmBuild; Node is provisioned by the Gradle Node plugin (download=true) | |
| run: ./gradlew buildPlugin | |
| # Prepare plugin archive content for creating artifact | |
| - name: Prepare Plugin Artifact | |
| id: artifact | |
| shell: bash | |
| run: | | |
| cd ${{ github.workspace }}/build/distributions | |
| FILENAME=`ls *.zip` | |
| unzip "$FILENAME" -d content | |
| echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT | |
| # Store already-built plugin as an artifact for downloading | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ steps.artifact.outputs.filename }} | |
| path: ./build/distributions/content/*/* | |
| # Run plugin structure verification along with IntelliJ Plugin Verifier | |
| verify: | |
| name: Verify plugin | |
| needs: [ build ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Free GitHub Actions Environment Disk Space | |
| - name: Maximize Build Space | |
| # jlumbroso/free-disk-space@v1.3.1: | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
| with: | |
| tool-cache: false | |
| large-packages: false | |
| # Check out the current repository | |
| - name: Fetch Sources | |
| uses: actions/checkout@v7 | |
| # Set up Java environment for the next steps | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| # Setup Gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6.2.0 | |
| # Gradle permission | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # Cache Plugin Verifier IDEs | |
| - name: Setup Plugin Verifier IDEs Cache | |
| uses: actions/cache@v6 | |
| with: | |
| path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides | |
| key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} | |
| # Run Verify Plugin task and IntelliJ Plugin Verifier tool | |
| - name: Run Plugin Verification tasks | |
| run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} | |
| # Collect Plugin Verifier Result | |
| - name: Collect Plugin Verifier Result | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pluginVerifier-result | |
| path: ${{ github.workspace }}/build/reports/pluginVerifier | |
| # Release | |
| release: | |
| name: Publish Plugin | |
| needs: [ build, verify ] | |
| if: startsWith(github.ref, 'refs/tags') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # Free GitHub Actions Environment Disk Space | |
| - name: Maximize Build Space | |
| # jlumbroso/free-disk-space@v1.3.1: | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
| with: | |
| tool-cache: false | |
| large-packages: false | |
| # Check out the current repository | |
| - name: Fetch Sources | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| # Set up Java environment for the next steps | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| # Setup Gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6.2.0 | |
| with: | |
| gradle-home-cache-cleanup: true | |
| # Gradle permission | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| # ChangeLog updated as part of the release process. See the DEPLOY.md for details. | |
| # Publish the plugin to JetBrains Marketplace | |
| - name: Publish Plugin | |
| env: | |
| PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | |
| CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} | |
| PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
| PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} | |
| run: ./gradlew publishPlugin | |
| # Upload artifact as a release asset | |
| - name: Upload Release Asset | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release upload ${{ github.ref_name }} ./build/distributions/* | |