Skip to content

Commit 58dd521

Browse files
Update GitHub Pages build logic
1 parent 7f01adf commit 58dd521

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copilot Instructions
2+
3+
## Project Guidelines
4+
- The mike docs default should only be set on pushes to master/main, so end users always land on the latest released version.

.github/workflows/docs.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,26 @@ jobs:
6262
echo "SemVer: $SEMVER"
6363
6464
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
65-
# Release tag -> deploy as the tag and alias to 'latest'
65+
# Tag push -> deploy as the tag name
6666
VERSION="${GITHUB_REF#refs/tags/}"
67-
mike set-default latest --push
67+
if [[ "$VERSION" == *-* ]]; then
68+
# Pre-release tag (e.g. 3.5.0-beta.1) -> deploy without aliasing to 'latest'
69+
mike deploy --push "$VERSION"
70+
else
71+
# Stable release tag (e.g. 3.5.0) -> deploy and alias to 'latest'
72+
mike deploy --push --update-aliases "$VERSION" latest
73+
fi
74+
75+
elif [[ "$GITHUB_REF" == refs/heads/master ]] || [[ "$GITHUB_REF" == refs/heads/main ]]; then
76+
# Main/master -> deploy as the GitVersion SemVer and alias to 'latest'
77+
VERSION="$SEMVER"
6878
mike deploy --push --update-aliases "$VERSION" latest
79+
mike set-default latest --push
6980
7081
elif [[ "$GITHUB_REF" == refs/heads/develop ]]; then
7182
# Develop -> rolling 'alpha' alias pointing to the GitVersion-computed SemVer
7283
VERSION="$SEMVER"
7384
mike deploy --push --update-aliases "$VERSION" alpha
74-
# Set default to 'alpha' only if a 'latest' alias (from a tagged release) does not exist yet
75-
if ! mike list | grep -q 'latest'; then
76-
mike set-default alpha --push
77-
fi
7885
7986
elif [[ "$GITHUB_REF" == refs/heads/release/* ]]; then
8087
# Any release/* -> rolling 'beta' alias pointing to the GitVersion-computed SemVer

0 commit comments

Comments
 (0)