Skip to content

Commit f974f7e

Browse files
ibuyspyCopilotCopilot
authored
fix(workflows): switch docs deploy to actions/deploy-pages for workflow-type Pages (#1394)
* fix(workflows): switch docs deploy to actions/deploy-pages Switch from mkdocs gh-deploy (legacy branch push) to the GitHub Actions native Pages deployment approach to match build_type:workflow config. Changes: - Replace mkdocs gh-deploy with mkdocs build + upload-pages-artifact + deploy-pages action steps - Add permissions for OIDC and environment: github-pages to deploy job - Remove Enable GitHub Pages step (REST API blocked; not needed with the workflow-native deploy approach) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: retrigger CI after sprint:35 label --------- Co-authored-by: Copilot <Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 18e6a27 commit f974f7e

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

.github/workflows/docs.yml

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ on:
1919
permissions:
2020
contents: write
2121
pages: write
22+
id-token: write
2223

2324
jobs:
2425
validate:
@@ -47,6 +48,9 @@ jobs:
4748
if: github.event_name != 'pull_request'
4849
needs: validate
4950
runs-on: ubuntu-latest
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deployment.outputs.page_url }}
5054
steps:
5155
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
5256
with:
@@ -76,34 +80,21 @@ jobs:
7680
sed -i "s|https://github.com/IBuySpy-Shared/basecoat|${REPO_URL}|gI" mkdocs.yml
7781
sed -i "s|IBuySpy-Shared/basecoat|${{ github.repository }}|g" mkdocs.yml
7882
79-
- name: Enable GitHub Pages (first run)
80-
run: |
81-
# Create Pages if it doesn't exist yet (POST)
82-
gh api --method POST "repos/${{ github.repository }}/pages" \
83-
--field 'source[branch]=gh-pages' \
84-
--field 'source[path]=/' 2>/dev/null || true
85-
86-
# Ensure Pages source points to gh-pages branch regardless of prior state (PUT).
87-
# Handles the case where Pages was already enabled with a different source branch.
88-
PAGES_BRANCH=$(gh api "repos/${{ github.repository }}/pages" \
89-
--jq '.source.branch' 2>/dev/null || echo "unknown")
90-
if [ "$PAGES_BRANCH" != "gh-pages" ]; then
91-
echo "Pages source is '$PAGES_BRANCH', updating to 'gh-pages'..."
92-
gh api --method PUT "repos/${{ github.repository }}/pages" \
93-
--field 'source[branch]=gh-pages' \
94-
--field 'source[path]=/' 2>/dev/null \
95-
&& echo "Pages source updated" \
96-
|| echo "Warning: could not update Pages source (may need manual update in repo settings)"
97-
else
98-
echo "Pages source already set to gh-pages"
99-
fi
83+
- name: Build docs
84+
run: mkdocs build
10085

86+
- name: Update repository homepage URL
87+
run: |
10188
gh api --method PATCH "repos/${{ github.repository }}" \
10289
--field "homepage=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" 2>/dev/null || true
10390
env:
10491
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10592

93+
- name: Upload Pages artifact
94+
uses: actions/upload-pages-artifact@98ef48e41587a300b82de4cf298aa98b57b2faae
95+
with:
96+
path: site/
97+
10698
- name: Deploy to GitHub Pages
107-
run: mkdocs gh-deploy --force --no-history
108-
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
id: deployment
100+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128

0 commit comments

Comments
 (0)