Upgrade to Intellij platform gradle plugin 2.0 (#70) #54
This file contains 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
# GitHub Action Workflow for building a new commit to the primary repo branch and publishing a new release to beta. | |
# | |
# Workflow is triggered on pushes into master. | |
# | |
# Additional Docs: | |
# - GitHub Actions: https://help.github.com/en/actions | |
name: build-master | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
branches: | |
- master | |
jobs: | |
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum | |
gradleValidation: | |
name: Gradle Wrapper | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch sources | |
uses: actions/checkout@v2 | |
# Validate wrapper | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v1 | |
# Build and test plugin and provide artifact. | |
build: | |
name: Build | |
needs: gradleValidation | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
product: [ "IC-2023.1", "IC-2023.2", "IC-2023.3", "IC-2024.1" ] | |
max-parallel: 5 | |
env: | |
PRODUCT_NAME: ${{ matrix.product }} | |
outputs: | |
name: ${{ steps.properties.outputs.name }} | |
version: ${{ steps.properties.outputs.version }} | |
artifact: ${{ steps.properties.outputs.artifact }} | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
# Cache Gradle dependencies | |
- name: Setup Gradle Dependencies Cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} | |
# Cache Gradle Wrapper | |
- name: Setup Gradle Wrapper Cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
# Set environment variables | |
- name: Export Properties | |
id: properties | |
shell: bash | |
run: | | |
PROPERTIES="$(./gradlew properties --console=plain -q)" | |
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')" | |
ARTIFACT="${NAME}-${VERSION}.zip" | |
echo "::set-output name=version::$VERSION" | |
echo "::set-output name=name::$NAME" | |
echo "::set-output name=artifact::$ARTIFACT" | |
# Build artifact using buildPlugin Gradle task | |
- name: Build Plugin | |
run: ./gradlew buildPlugin | |
# Run intellij:verifyPlugin task. | |
- name: Verify Plugin | |
run: ./gradlew verifyPlugin | |
# Publish plugin to beta channel | |
- name: Publish Beta Plugin | |
if: github.repository == 'amazon-ion/ion-intellij-plugin' | |
env: | |
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_TOKEN }} | |
PUBLISH_CHANNEL: beta | |
run: ./gradlew --stacktrace publishPlugin | |
# Upload plugin artifact to make it available in the next jobs | |
- name: Upload artifact | |
if: github.repository == 'amazon-ion/ion-intellij-plugin' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.product }}-plugin-artifact | |
path: ./build/distributions/${{ needs.build.outputs.artifact }} |