-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #334 from fboundy/patch
Patch
- Loading branch information
Showing
2 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,22 +16,28 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Fetch main branch into a detached HEAD | ||
run: | | ||
git fetch origin main | ||
git checkout origin/main -b temp-main-branch | ||
- 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) | ||
VERSION=$(grep -m 1 -oP '(?<=^VERSION = ")[^"]+' apps/pv_opt/pv_opt.py) | ||
if [ -z "$VERSION" ]; then | ||
echo "Error: VERSION not found in apps/pv_opt/pv_opt.py on patch branch." >&2 | ||
exit 1 | ||
fi | ||
echo "patch_version=$VERSION" >> $GITHUB_ENV | ||
- name: Get VERSION from main branch | ||
id: get_main_version | ||
run: | | ||
git checkout temp-main-branch | ||
VERSION=$(grep -m 1 -oP '^VERSION=\K.*' VERSION_FILE) | ||
git checkout main | ||
VERSION=$(grep -m 1 -oP '(?<=^VERSION = ")[^"]+' apps/pv_opt/pv_opt.py) | ||
if [ -z "$VERSION" ]; then | ||
echo "Error: VERSION not found in apps/pv_opt/pv_opt.py on main branch." >&2 | ||
exit 1 | ||
fi | ||
echo "main_version=$VERSION" >> $GITHUB_ENV | ||
- name: Validate version increment | ||
|
@@ -44,7 +50,27 @@ jobs: | |
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 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
name: Auto-format Code with Debugging | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
|