Skip to content

Commit

Permalink
Merge pull request #332 from fboundy/patch
Browse files Browse the repository at this point in the history
Patch
  • Loading branch information
fboundy authored Dec 31, 2024
2 parents b611c07 + 2910b15 commit 507545f
Showing 1 changed file with 59 additions and 3 deletions.
62 changes: 59 additions & 3 deletions .github/workflows/auto_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,70 @@ on:
push:
branches:
- main # Trigger on pushes to main (e.g., after a PR is merged)
pull_request_review:
types:
- submitted # Trigger when a review is submitted

jobs:
validate-version:
name: Validate Version
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch main branch
run: git fetch origin main:main

- name: Get VERSION from patch branch
id: get_patch_version
run: |
VERSION=$(grep -m 1 -oP '^VERSION=\K.*' VERSION_FILE)
echo "patch_version=$VERSION" >> $GITHUB_ENV
- name: Get VERSION from main branch
id: get_main_version
run: |
git checkout main
VERSION=$(grep -m 1 -oP '^VERSION=\K.*' VERSION_FILE)
echo "main_version=$VERSION" >> $GITHUB_ENV
- name: Validate version increment
id: validate_version
run: |
patch_version=$patch_version
main_version=$main_version
# Extract PATCH numbers
main_patch=$(echo "$main_version" | awk -F '.' '{print $3}')
patch_patch=$(echo "$patch_version" | awk -F '.' '{print $3}')
# Check if the patch version is incremented correctly
if [ "$patch_patch" -ne $((main_patch + 1)) ]; then
echo "Error: PATCH version is not incremented correctly." >&2
echo "Main version: $main_version, Patch version: $patch_version" >&2
exit 1
fi
- name: Update README.md version
run: |
sed -i "1s/v[0-9]*\.[0-9]*\.[0-9]*/v$patch_version/" README.md
- name: Commit README.md changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add README.md
git commit -m "Update README.md version to $patch_version"
- name: Push changes back to patch branch
run: |
git push origin HEAD:patch
publish-release:
name: Publish Release
runs-on: ubuntu-latest
needs: validate-version

steps:
# Step 1: Checkout the repository
Expand Down

0 comments on commit 507545f

Please sign in to comment.