Skip to content

Commit

Permalink
fix: only trigger semver bump on merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Aug 8, 2024
1 parent 0eaf2da commit 2e3bb47
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Bump Version

on:
push:
branches:
- main
pull_request:
types:
- closed

jobs:
bump-version:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master'
runs-on: ubuntu-latest
steps:
- name: Generate token
Expand Down Expand Up @@ -37,7 +38,6 @@ jobs:
id: bump-version
run: |
current_version=$(grep -oP 'const Version = "\K[^"]+' version.go)
echo "current_version=$current_version" >> $GITHUB_OUTPUT
IFS='.' read -ra version_parts <<< "$current_version"
major=${version_parts[0]}
minor=${version_parts[1]}
Expand All @@ -50,11 +50,12 @@ jobs:
fi
sed -i "s/const Version = \"$current_version\"/const Version = \"$new_version\"/" version.go
echo "current_version=$current_version" >> $GITHUB_OUTPUT
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Update CHANGELOG.md
run: |
current_version="${{ steps.bump-version.output.current_version }}"
current_version="${{ steps.bump-version.outputs.current_version }}"
new_version="${{ steps.bump-version.outputs.new_version }}"
echo -e "## $new_version\n\n* [Full Changelog](https://github.com/PostHog/posthog-go/compare/v${current_version}...v${new_version})\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
Expand Down

0 comments on commit 2e3bb47

Please sign in to comment.