Skip to content

Commit c451ca9

Browse files
committed
fix: resolve docs deployment failures due to environment protection rules
The docs workflow was failing when triggered by release events because GitHub Pages environment protection rules block deployments from tags. This fix ensures docs are always built from the main branch while maintaining correct version information. Changes: - Remove direct release event trigger to prevent duplicate workflow runs - Always checkout main branch to satisfy environment protection rules - Enhance version detection to use release tag when available - Rely on repository_dispatch from release workflow for docs deployment The release workflow already triggers docs via repository_dispatch, making the direct release trigger redundant and problematic. This change creates a single, reliable docs deployment path that works with GitHub Pages protection rules. Resolves deployment failures: "Tag 'v1.0.1' is not allowed to deploy to github-pages"
1 parent 4238522 commit c451ca9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/docs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Deploy Docs
22
on:
33
workflow_dispatch:
4-
release:
5-
types: [published]
64
repository_dispatch:
75
types: [build-docs]
86

@@ -27,6 +25,7 @@ jobs:
2725
- name: Checkout
2826
uses: actions/checkout@v4
2927
with:
28+
ref: main # Always checkout main branch for docs builds
3029
fetch-depth: 0 # Fetch all history for all branches and tags
3130
fetch-tags: true # Explicitly fetch tags
3231

@@ -61,7 +60,13 @@ jobs:
6160

6261
- name: Set Release Version in Docs
6362
run: |
64-
VERSION=$(cat gradle.properties | grep "version" | cut -d'=' -f2 | tr -d ' ')
63+
# Use the release tag version if triggered by release, otherwise use gradle.properties
64+
if [ "${{ github.event_name }}" = "release" ]; then
65+
VERSION="${{ github.event.release.tag_name }}"
66+
VERSION=${VERSION#v} # Remove 'v' prefix if present
67+
else
68+
VERSION=$(cat gradle.properties | grep "version" | cut -d'=' -f2 | tr -d ' ')
69+
fi
6570
echo "Setting documentation version to $VERSION"
6671
6772
# For current version

0 commit comments

Comments
 (0)