diff --git a/.github/actions/deploy-to-gh-pages/action.yml b/.github/actions/deploy-to-gh-pages/action.yml index 25f5bf1991..461c1f7512 100644 --- a/.github/actions/deploy-to-gh-pages/action.yml +++ b/.github/actions/deploy-to-gh-pages/action.yml @@ -34,6 +34,37 @@ runs: id: deployment uses: actions/deploy-pages@v4 + - name: Sync content to gh-pages branch + shell: bash + run: | + cd "${{ inputs.content-path }}" + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + if [ ! -d ".git" ]; then + git init -b gh-pages + git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" + else + # Ensure we're on gh-pages branch (the failed checkout may have + # left us on 'master' after git init with no gh-pages ref) + CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "") + if [ "$CURRENT_BRANCH" != "gh-pages" ]; then + git checkout -B gh-pages + fi + # Ensure remote URL uses the token for authentication + git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" 2>/dev/null || \ + git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" + fi + + git add -A + if git diff --cached --quiet; then + echo "gh-pages branch already up to date" + else + git commit -m "Sync: ${{ inputs.deployment-name }}" + git push origin gh-pages + fi + - name: Deployment summary shell: bash run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 443bfba4fc..8bb7b7ff0b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -117,7 +117,7 @@ jobs: name: Deploy Picasso docs runs-on: ubuntu-latest concurrency: - group: gh-pages-deployment-pr + group: gh-pages-deployment cancel-in-progress: false permissions: contents: write diff --git a/.github/workflows/cleanup-previews.yml b/.github/workflows/cleanup-previews.yml index 770132c629..871f9cfcfa 100644 --- a/.github/workflows/cleanup-previews.yml +++ b/.github/workflows/cleanup-previews.yml @@ -26,7 +26,7 @@ on: - force_all concurrency: - group: gh-pages-deployment-pr + group: gh-pages-deployment cancel-in-progress: false jobs: