Skip to content

feat: Improve log format and add minimize-on-deactivate to extraction… #16

feat: Improve log format and add minimize-on-deactivate to extraction…

feat: Improve log format and add minimize-on-deactivate to extraction… #16

Workflow file for this run

name: Version Bump
on:
push:
branches: [main]
paths:
- 'qBitLauncher.ps1'
jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write # Allow pushing commits
# Only run if commit message contains version keywords
if: |
contains(github.event.head_commit.message, 'feat:') ||
contains(github.event.head_commit.message, 'fix:') ||
contains(github.event.head_commit.message, 'BREAKING:')
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Get current version
id: get_version
run: |
CURRENT_VERSION=$(grep -oP '\$Global:ScriptVersion\s*=\s*"\K[^"]+' qBitLauncher.ps1)
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Current version: $CURRENT_VERSION"
- name: Calculate new version
id: calc_version
run: |
CURRENT="${{ steps.get_version.outputs.current }}"
IFS='.' read -ra PARTS <<< "$CURRENT"
MAJOR=${PARTS[0]:-1}
MINOR=${PARTS[1]:-0}
PATCH=${PARTS[2]:-0}
COMMIT_MSG="${{ github.event.head_commit.message }}"
if [[ "$COMMIT_MSG" == *"BREAKING:"* ]]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [[ "$COMMIT_MSG" == *"feat:"* ]]; then
MINOR=$((MINOR + 1))
PATCH=0
elif [[ "$COMMIT_MSG" == *"fix:"* ]]; then
PATCH=$((PATCH + 1))
fi
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "New version: $NEW_VERSION"
- name: Update version in script
if: steps.get_version.outputs.current != steps.calc_version.outputs.new
run: |
NEW_VERSION="${{ steps.calc_version.outputs.new }}"
# Use sed - escape $ with backslash in replacement string
sed -i 's/\$Global:ScriptVersion = "[^"]*"/\$Global:ScriptVersion = "'"$NEW_VERSION"'"/' qBitLauncher.ps1
# Verify the change was made
grep 'ScriptVersion' qBitLauncher.ps1 | head -1
echo "Updated version to $NEW_VERSION"
- name: Commit and push
if: steps.get_version.outputs.current != steps.calc_version.outputs.new
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add qBitLauncher.ps1
git commit -m "chore: bump version to ${{ steps.calc_version.outputs.new }}"
git push