Skip to content

Release

Release #41

Workflow file for this run

# 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.
name: Release
on:
release:
types: [prereleased, released]
jobs:
# Prepare and publish the plugin to the Marketplace repository
release:
name: Publish Plugin
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Install Radicle
env:
RAD_HOME: ${{ github.workspace }}/.radicle
run: |
curl -sSf https://radicle.xyz/install | sh
echo "${RAD_HOME}/bin" >> $GITHUB_PATH
echo "RAD_HOME=${{ github.workspace }}/.radicle" >> $GITHUB_ENV
- name: Extract Changelog
id: changelog
shell: bash
run: |
CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d'
${{ github.event.release.body }}
EOM
)"
# remove empty lines, otherwise changelog plugin will lose rest of content
CHANGELOG="$(echo "$CHANGELOG" | grep -v '^$')"
if [[ "${CHANGELOG}" == "" ]]; then
echo "ERROR! Empty changelog! Aborting release!"
exit 1
fi
echo 'changelog<<EOF' >> $GITHUB_OUTPUT
echo "${CHANGELOG}" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
# Update Unreleased section with the current release note
- name: Patch Changelog
if: ${{ steps.changelog.outputs.changelog != '' }}
env:
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
run: |
echo "patching changelog with: $CHANGELOG"
./gradlew :patchChangelog --release-note="$CHANGELOG"
# Create pull request with changelog update
- name: Push changelog update
if: ${{ steps.changelog.outputs.changelog != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.event.release.tag_name }}"
git config user.email "action@github.com"
git config user.name "GitHub Action"
git checkout -b main
git commit -am "Changelog update - $VERSION
Signed-off-by: github-actions <action@github.com>
"
git push --set-upstream origin main
# Publish the plugin to the Marketplace
- name: Publish Plugin
env:
# PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
PUBLISH_TOKEN: ${{ secrets.CYTECH_PUBLISH_TOKEN }}
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
run: ./gradlew :publishPlugin
# 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/*