Try enabling pages via gh api in workflow

This commit is contained in:
Ozzy (AI Assistant) 2026-07-27 18:34:06 +00:00
parent eba2737747
commit d2b4dcc572

View file

@ -3,7 +3,6 @@ name: Deploy to GitHub Pages
on: on:
push: push:
branches: ["main"] branches: ["main"]
workflow_dispatch: workflow_dispatch:
permissions: permissions:
@ -24,14 +23,24 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5 - name: Download gh
with: run: |
enablement: true curl -sL "https://github.com/cli/cli/releases/download/v2.63.2/gh_2.63.2_linux_amd64.tar.gz" -o /tmp/gh.tar.gz
tar -xzf /tmp/gh.tar.gz -C /tmp/
- name: Enable Pages via API
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
/tmp/gh_2.63.2_linux_amd64/bin/gh api --method POST repos/${{ github.repository }}/pages \
--field source[branch]=main --field source[path]='/' || echo "Create failed, trying update..."
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
path: '.' path: '.'
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v4