-
-
Notifications
You must be signed in to change notification settings - Fork 193
63 lines (56 loc) · 2.05 KB
/
Copy pathdeploy.yml
File metadata and controls
63 lines (56 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Deploy Main and Beta to GitHub Pages
on:
push:
branches:
- main
- beta
workflow_dispatch:
permissions:
contents: write
concurrency:
group: deploy-gh-pages
cancel-in-progress: false
jobs:
build-and-deploy:
if: "!contains(github.event.head_commit.message, '[skip pages]') && !contains(github.event.head_commit.message, '[auto-enhanced]') && github.actor != 'github-pages[bot]'"
runs-on: ubuntu-latest
steps:
- name: Create deployment structure
run: mkdir -p gh-pages-content/beta
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
path: main-content
- name: Checkout beta branch
uses: actions/checkout@v4
with:
ref: beta
path: beta-content
- name: Prepare content
run: |
rsync -av --exclude='.git/' main-content/ gh-pages-content/
rsync -av --exclude='.git/' beta-content/ gh-pages-content/beta/
echo "Removing files larger than 25MB from deployment payload"
find gh-pages-content -type f -size +25M -print -delete || true
echo "Deployment content (recursive):"
ls -laR gh-pages-content
- name: Push to gh-pages branch
run: |
cd gh-pages-content
git init
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
# /* Ensure this commit message contains '[skip pages]' */
git commit -m "Deploy main and beta to GitHub Pages [skip pages]"
git branch -M gh-pages
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
for attempt in 1 2 3; do
if git push -f origin gh-pages; then
exit 0
fi
echo "gh-pages push failed on attempt ${attempt}; retrying after ref-lock backoff..."
sleep $((attempt * 10))
done
git push -f origin gh-pages