2020-06-17 19:06:57 +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 the PUBLISH_TOKEN secret provided.
|
|
|
|
|
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
|
|
|
|
|
|
|
# Prepare and publish the plugin to the Marketplace repository
|
2020-06-17 05:19:59 +00:00
|
|
|
release:
|
|
|
|
name: Publish Plugin
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2021-05-12 06:11:22 +00:00
|
|
|
uses: actions/checkout@v2.3.4
|
2020-06-22 20:19:50 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.release.tag_name }}
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2021-08-31 07:04:03 +00:00
|
|
|
# Setup Java 11 environment for the next steps
|
|
|
|
- name: Setup Java
|
|
|
|
uses: actions/setup-java@v2
|
2021-08-26 14:48:38 +00:00
|
|
|
with:
|
2021-08-31 07:04:03 +00:00
|
|
|
distribution: zulu
|
|
|
|
java-version: 11
|
|
|
|
cache: gradle
|
2021-08-26 14:48:38 +00:00
|
|
|
|
|
|
|
# Update Unreleased section with the current release note
|
|
|
|
- name: Patch Changelog
|
|
|
|
run: |
|
|
|
|
./gradlew patchChangelog --release-note="`cat << EOM
|
|
|
|
${{ github.event.release.body }}
|
|
|
|
EOM`"
|
|
|
|
|
2020-06-19 07:51:04 +00:00
|
|
|
# Publish the plugin to the Marketplace
|
2020-06-17 05:19:59 +00:00
|
|
|
- name: Publish Plugin
|
|
|
|
env:
|
|
|
|
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
|
|
|
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
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
# Create pull request
|
|
|
|
- name: Create Pull Request
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
VERSION="${{ github.event.release.tag_name }}"
|
|
|
|
BRANCH="changelog-update-$VERSION"
|
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
|
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." \
|
|
|
|
--base main \
|
|
|
|
--head $BRANCH
|