Version Bump PR #46
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
name: Version Bump PR | |
on: | |
workflow_dispatch: | |
inputs: | |
bump_type: | |
description: 'Version Bump Type (major, minor, patch)' | |
required: true | |
default: 'minor' | |
permissions: | |
contents: write | |
jobs: | |
version_bump_pr: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Check out the repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
fetch-depth: 0 | |
- name: Bump version | |
id: bump_version | |
run: | | |
BUMP_TYPE="${{ github.event.inputs.bump_type }}" | |
case "$BUMP_TYPE" in | |
major) | |
NEW_VERSION=$(cat VERSION | awk -F. '{printf "%d.0.0", $1+1}') | |
;; | |
minor) | |
NEW_VERSION=$(cat VERSION | awk -F. '{printf "%s.%d.0", $1, $2+1}') | |
;; | |
patch) | |
NEW_VERSION=$(cat VERSION | awk -F. '{printf "%s.%s.%d", $1, $2, $3+1}') | |
;; | |
*) | |
echo "Error: Invalid bump type" | |
exit 1 | |
;; | |
esac | |
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
echo $NEW_VERSION > VERSION | |
sed -i "s/VERSION_STRING: Final = \"[0-9]*\.[0-9]*\.[0-9]*\"/VERSION_STRING: Final = \"$NEW_VERSION\"/" panther_analysis_tool/constants.py | |
- name: Create Branch and Pull Request | |
run: | | |
NEW_VERSION="${{ steps.bump_version.outputs.new_version }}" | |
git config user.name "dac-bot[bot]" | |
git config user.email "[email protected]" | |
git checkout -b "$NEW_VERSION" | |
git commit -a -m "Bump version to $NEW_VERSION" | |
git push --set-upstream origin "$NEW_VERSION" | |
gh pr create -t "Version bump to v$NEW_VERSION" -b "Bumping Version to v$NEW_VERSION ahead of release." | |
env: | |
GH_TOKEN: ${{ secrets.PANTHER_BOT_AUTOMATION_TOKEN }} |