-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use most recent release when creating stable branch the first time
- Loading branch information
Showing
1 changed file
with
8 additions
and
3 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 |
---|---|---|
|
@@ -22,22 +22,27 @@ jobs: | |
run: | | ||
git config user.name "Automated" | ||
git config user.email "[email protected]" | ||
- name: Check if stable branch exists | ||
run: | | ||
if ! git ls-remote --heads origin stable | grep stable; then | ||
# Fetch all tags and sort them in descending order | ||
LATEST_RELEASE=$(git tag | sort -Vr | head -n1) | ||
# If no release is found, default to the main branch | ||
if [ -z "$LATEST_RELEASE" ]; then | ||
LATEST_RELEASE="main" | ||
fi | ||
# Check out the latest release or main branch | ||
git checkout $LATEST_RELEASE | ||
git checkout -b stable | ||
git push -u origin stable | ||
fi | ||
- name: Handle Release | ||
if: github.event_name == 'release' | ||
run: | | ||
git fetch --all | ||
git checkout stable | ||
git reset --hard ${GITHUB_REF#refs/tags/} | ||
git push origin stable --force | ||
- name: Handle Commit to Main | ||
if: contains(github.event.head_commit.message, '!stable-docs') | ||
run: | | ||
|