Release #36
Workflow file for this run
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 handling the release process | |
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided. | |
name: Release | |
on: | |
release: | |
types: [ released ] | |
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: 11 | |
# 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 | |
# Upload plugin artifact | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: plugin-artifact | |
path: build/distributions/${{ steps.properties.outputs.name }}-${{ steps.properties.outputs.version }}.zip | |
if-no-files-found: error | |
# Prepare and publish the plugin to the Marketplace repository | |
release: | |
needs: build | |
name: Publish Plugin | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Setup Java 11 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
# Publish the plugin to the Marketplace | |
- name: Publish Plugin | |
env: | |
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | |
GIT_RELEASE: ${{ github.event.release.tag_name }} | |
run: ./gradlew publishPlugin --stacktrace | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: plugin-artifact | |
- name: Update Release Notes and Assets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api repos/${{ github.repository }}/releases/${{ github.event.release.id }} -f body="${{ needs.build.outputs.changelog }}" | |
gh release upload ${{ github.event.release.tag_name }} "${{ needs.build.outputs.artifact }}" |