feat(intellj): Add intellij plugin for IaC scan #9
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 based on the draft release prepared with the Build workflow. | |
# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN. | |
# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. | |
name: Intellij Release | |
on: | |
push: | |
tags: | |
- intellij-v* | |
jobs: | |
# Prepare and publish the plugin to JetBrains Marketplace repository | |
release: | |
name: Publish Plugin | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
# Generate a token of Github APP | |
- name: Generate a token | |
id: generate_token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: ${{ secrets.APP_ID_ADMIN_GITHUB }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY_ADMIN_GITHUB }} | |
# Check out the current repository | |
- name: Fetch Sources | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
ref: ${{ github.event.release.tag_name }} | |
# Set up Java environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 17 | |
# Setup Gradle | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/intellij-v}" >> $GITHUB_ENV | |
- name: Upgrade Gradle.properties | |
run: sed -i 's/pluginVersion=.*/pluginVersion=${{ env.RELEASE_VERSION }}/g' gradle.properties | |
working-directory: ./ide_extension/intellij | |
- name: Export Properties | |
id: properties | |
working-directory: ./ide_extension/intellij | |
shell: bash | |
run: | | |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' | |
${{ github.event.release.body }} | |
EOM | |
)" | |
CHANGELOG="${CHANGELOG//'%'/'%25'}" | |
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" | |
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" | |
echo "::set-output name=changelog::$CHANGELOG" | |
- name: Patch Changelog | |
if: ${{ steps.properties.outputs.changelog != '' }} | |
working-directory: ./ide_extension/intellij | |
env: | |
CHANGELOG: ${{ steps.properties.outputs.changelog }} | |
run: | | |
./gradlew patchChangelog --release-note="$CHANGELOG" | |
- name: Save version | |
uses: github-actions-x/commit@722d56b8968bf00ced78407bbe2ead81062d8baa # v2.9 | |
with: | |
github-token: ${{ steps.generate_token.outputs.token }} | |
push-branch: "trunk" | |
commit-message: 'upgrade version to ${{ env.RELEASE_VERSION }} version [skip ci]' | |
force-add: "true" | |
force-push: "true" | |
files: ide_extension/intellij/CHANGELOG.md ide_extension/intellij/gradle.properties | |
name: Release Bot | |
email: [email protected] | |
# 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 }} | |
working-directory: ./ide_extension/intellij | |
run: ./gradlew publishPlugin |