Build PyCharm Plugin #15
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 PyCharm Plugin | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version tag (e.g., 0.2.1)' | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| ide-plugins/.gradle | |
| key: gradle-17-${{ hashFiles('ide-plugins/**/*.gradle*','ide-plugins/**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-17- | |
| - name: Setup Gradle wrapper if missing | |
| run: | | |
| if [ ! -f gradlew ] || [ ! -f gradle/wrapper/gradle-wrapper.jar ]; then | |
| echo "Setting up Gradle wrapper for Gradle 9.2.0..." | |
| cd /tmp | |
| curl -L -s -o gradle-9.2.0.zip https://services.gradle.org/distributions/gradle-9.2.0-bin.zip | |
| unzip -q gradle-9.2.0.zip | |
| cd $GITHUB_WORKSPACE/ide-plugins | |
| /tmp/gradle-9.2.0/bin/gradle wrapper --gradle-version 9.2.0 | |
| chmod +x gradlew | |
| echo "Wrapper installed" | |
| fi | |
| working-directory: ide-plugins | |
| - name: Set version environment variable | |
| run: echo "PLUGIN_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
| - name: Build plugin | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g" | |
| PLUGIN_VERSION: ${{ github.event.inputs.version }} | |
| run: ./gradlew buildPlugin -Pversion=${{ github.event.inputs.version }} --no-daemon --stacktrace | |
| working-directory: ide-plugins | |
| - name: Upload plugin artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: intellij-plugin-${{ github.event.inputs.version }} | |
| path: ide-plugins/build/distributions/*.zip | |
| - name: Upload to Release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ide-plugins/build/distributions/*.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |