Transfer code ownership (#75) #340
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 Actions Workflow created for testing and preparing the plugin release in following steps: | |
# - validate Gradle Wrapper, | |
# - run test and verifyPlugin tasks, | |
# - run buildPlugin task and prepare artifact for the further tests, | |
# - run IntelliJ Plugin Verifier, | |
# - create a draft release. | |
# | |
# Workflow is triggered on push and pull_request events. | |
# | |
# Docs: | |
# - GitHub Actions: https://help.github.com/en/actions | |
# - IntelliJ Plugin Verifier GitHub Action: https://github.com/ChrisCarini/intellij-platform-plugin-verifier-action | |
# | |
name: Build | |
on: | |
push: | |
branches: | |
- main | |
# Trigger the workflow on any pull request | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
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@v3 | |
# Validate wrapper | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v1 | |
build: | |
name: Build & Verify | |
needs: gradleValidation | |
runs-on: ubuntu-latest | |
outputs: | |
name: ${{ steps.properties.outputs.name }} | |
version: ${{ steps.properties.outputs.version }} | |
artifact: ${{ steps.properties.outputs.name }}-${{ steps.properties.outputs.version }}.zip | |
changelog: ${{ steps.properties.outputs.changelog }} | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
# Setup Java 11 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
# Cache Gradle dependencies | |
- name: Setup Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
# Run check Gradle task - includes tests | |
- name: Run Checks | |
run: ./gradlew check | |
# Run verifyPlugin Gradle task | |
- name: Verify Plugin | |
run: ./gradlew verifyPlugin | |
# Set environment variables | |
- name: Export Properties | |
id: properties | |
run: | | |
echo "::set-output name=version::$(./gradlew properties --console=plain -q | grep "^version:" | awk '{printf $2}')" | |
echo "::set-output name=name::$(./gradlew properties --console=plain -q | grep "^name:" | awk '{printf $2}')" | |
CHANGELOG=$(./gradlew getChangelog --unreleased --no-header --console=plain -q) | |
CHANGELOG="${CHANGELOG//'%'/'%25'}" | |
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" | |
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" | |
echo "::set-output name=changelog::$CHANGELOG" | |
# Build artifact using buildPlugin Gradle task | |
- name: Build Plugin | |
run: ./gradlew buildPlugin | |
- name: Summary | |
run: | | |
echo "Name: ${{ steps.properties.outputs.name }}" | |
echo "Version: ${{ steps.properties.outputs.version }}" | |
echo "Artifact: ${{ steps.properties.outputs.name }}-${{ steps.properties.outputs.version }}.zip" | |
echo "Changelog: ${{ steps.properties.outputs.changelog }}" | |
# Run IntelliJ Plugin Verifier action using GitHub Action | |
- name: Verify Plugin Compatibility | |
uses: ChrisCarini/intellij-platform-plugin-verifier-action@v1.2.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
ide-versions: .github/workflows/ide_versions_file.txt | |
failure-levels: | | |
COMPATIBILITY_PROBLEMS | |
INVALID_PLUGIN | |
NOT_DYNAMIC |