2023-01-13 20:34:46 +00:00
|
|
|
# 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.
|
2020-06-17 19:06:57 +00:00
|
|
|
|
2020-06-17 05:19:59 +00:00
|
|
|
name: Release
|
|
|
|
on:
|
|
|
|
release:
|
2020-07-06 20:02:43 +00:00
|
|
|
types: [prereleased, released]
|
2020-06-17 05:19:59 +00:00
|
|
|
|
|
|
|
jobs:
|
2020-06-19 07:51:04 +00:00
|
|
|
|
2023-07-27 16:06:04 +00:00
|
|
|
# Prepare and publish the plugin to JetBrains Marketplace repository
|
2020-06-17 05:19:59 +00:00
|
|
|
release:
|
|
|
|
name: Publish Plugin
|
|
|
|
runs-on: ubuntu-latest
|
2022-05-05 12:13:53 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2022-05-14 10:59:07 +00:00
|
|
|
pull-requests: write
|
2020-06-17 05:19:59 +00:00
|
|
|
steps:
|
|
|
|
|
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2023-09-05 06:17:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-06-22 20:19:50 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.release.tag_name }}
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Set up Java environment for the next steps
|
2023-07-10 14:55:15 +00:00
|
|
|
- name: Setup Java
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
distribution: zulu
|
|
|
|
java-version: 17
|
|
|
|
|
2023-06-27 10:09:38 +00:00
|
|
|
# Setup Gradle
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
2023-08-04 09:58:42 +00:00
|
|
|
with:
|
|
|
|
gradle-home-cache-cleanup: true
|
2021-08-26 14:48:38 +00:00
|
|
|
|
2021-10-14 11:29:30 +00:00
|
|
|
# Set environment variables
|
|
|
|
- name: Export Properties
|
|
|
|
id: properties
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
|
|
|
|
${{ github.event.release.body }}
|
|
|
|
EOM
|
|
|
|
)"
|
|
|
|
|
2023-02-21 08:20:55 +00:00
|
|
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
|
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
2021-10-14 11:29:30 +00:00
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
# Update Unreleased section with the current release note
|
|
|
|
- name: Patch Changelog
|
2021-10-14 11:29:30 +00:00
|
|
|
if: ${{ steps.properties.outputs.changelog != '' }}
|
2021-11-25 12:06:49 +00:00
|
|
|
env:
|
|
|
|
CHANGELOG: ${{ steps.properties.outputs.changelog }}
|
2021-08-26 14:48:38 +00:00
|
|
|
run: |
|
2021-11-25 12:06:49 +00:00
|
|
|
./gradlew patchChangelog --release-note="$CHANGELOG"
|
2021-08-26 14:48:38 +00:00
|
|
|
|
2023-07-27 16:06:04 +00:00
|
|
|
# Publish the plugin to JetBrains Marketplace
|
2020-06-17 05:19:59 +00:00
|
|
|
- name: Publish Plugin
|
|
|
|
env:
|
|
|
|
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
2022-08-05 13:37:48 +00:00
|
|
|
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
|
|
|
|
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
|
|
|
|
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
|
2020-06-17 05:19:59 +00:00
|
|
|
run: ./gradlew publishPlugin
|
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
# Upload artifact as a release asset
|
|
|
|
- name: Upload Release Asset
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
|
2020-09-17 19:54:36 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Create a pull request
|
2021-08-26 14:48:38 +00:00
|
|
|
- name: Create Pull Request
|
2021-10-14 11:29:30 +00:00
|
|
|
if: ${{ steps.properties.outputs.changelog != '' }}
|
2021-08-26 14:48:38 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
VERSION="${{ github.event.release.tag_name }}"
|
|
|
|
BRANCH="changelog-update-$VERSION"
|
2022-09-19 10:12:57 +00:00
|
|
|
LABEL="release changelog"
|
2020-07-07 04:26:29 +00:00
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
git config user.email "action@github.com"
|
|
|
|
git config user.name "GitHub Action"
|
2020-07-07 04:26:29 +00:00
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
git checkout -b $BRANCH
|
|
|
|
git commit -am "Changelog update - $VERSION"
|
|
|
|
git push --set-upstream origin $BRANCH
|
2022-09-19 10:12:57 +00:00
|
|
|
|
|
|
|
gh label create "$LABEL" \
|
|
|
|
--description "Pull requests with release changelog update" \
|
2023-08-17 08:59:20 +00:00
|
|
|
--force \
|
2022-09-19 10:12:57 +00:00
|
|
|
|| true
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
gh pr create \
|
|
|
|
--title "Changelog update - \`$VERSION\`" \
|
|
|
|
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
|
2022-09-19 10:12:57 +00:00
|
|
|
--label "$LABEL" \
|
2021-08-26 14:48:38 +00:00
|
|
|
--head $BRANCH
|