-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.29 KB
/
deploy-main.yml
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
name: Deploy main branch to Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages-main"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Setup Git
run: |
git config --global user.name 'Arisamiga'
git config --global user.email '${{ secrets.EMAIL }}'
- name: Checkout gh-pages branch
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
git clone --depth 1 --branch gh-pages https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${{ github.repository }} gh-pages
- name: Create demo directory
run: |
mkdir -p gh-pages/demo
- name: Copy contents to demo folder
run: |
rsync -av --delete ./Website/ gh-pages/demo/
- name: Commit and push changes
run: |
cd gh-pages
git add .
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Deploy main branch to demo"
git push origin gh-pages
else
echo "No changes to commit"
fi