Skip to content

Trigger Release

Trigger Release #16

name: "Trigger Release"
on:
workflow_dispatch:
inputs:
new_version:
description: "Release Version (no 'v'). End with `-rc.#` for release candidate"
required: true
type: string
jobs:
perform-release:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
# Required to trigger follow-on workflow runs
# https://github.com/stefanzweifel/git-auto-commit-action#commits-made-by-this-action-do-not-trigger-new-workflow-runs
token: ${{ secrets.PAT }}
- name: Update Changelog
uses: thomaseizinger/keep-a-changelog-new-release@f62c3c390716df5af712ba5d94f4f4a8efc1306d # 3.1.0
with:
tag: v${{ github.event.inputs.new_version }}
version: ${{ github.event.inputs.new_version }}
- name: Update README
run: |
new_version=$(echo "${{ github.event.inputs.new_version }}")
stripped_version=$($new_version | sed -e 's/\.//g')
formatted_date=$(date "+%Y%m%d")
sed -i 's|\(Latest plugin version: \[\).*\(\](/CHANGELOG.md#\).*---.*)|\1'"$new_version"'\2'"$stripped_version"'---'"$formatted_date"')|' README.md
- name: Upload Changed Files as Artifacts
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: changed-files
path: |
CHANGELOG.md
README.md
- name: Cleanup Changed Files for RC
if: contains(github.event.inputs.new_version, '-rc.')
run: |
# Reset the README.md and CHANGELOG.md files to their original state
git checkout HEAD -- README.md CHANGELOG.md
- name: Perform Tagging and Push
# This will trigger the new release job that will take the tag and push the release to the plugin portal
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
with:
commit_options: --allow-empty
commit_message: Release version ${{ github.event.inputs.new_version }}
tagging_message: 'v${{ github.event.inputs.new_version }}'
skip_dirty_check: ${{contains(github.event.inputs.new_version, '-rc.')}}