-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (57 loc) · 1.58 KB
/
Copy pathdeploy.yml
File metadata and controls
71 lines (57 loc) · 1.58 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
64
65
66
67
68
69
70
71
name: Deploy site to Github Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build-and-commit:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Build Check
uses: ./.github/actions/build
- name: Move out directory
run: |
mkdir -p /tmp/out
mv ./out/* /tmp/out
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Preserve specific directories
run: |
if [ -e ./preview ]; then
mkdir -p /tmp/preview
mv ./preview/* /tmp/preview
fi
- name: Clean
run: |
find . -type f ! -path "./.github/*" ! -path "./.git/*" -delete
- name: Adapt new build
run: |
cp -r -f /tmp/out/* ./
if [ -e /tmp/preview ]; then
cp -r -f /tmp/preview/* ./preview
fi
touch .nojekyll || true
- name: Commit changes to gh-pages branch
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "action@github.com"
git add -N .
set +e
git diff --exit-code --quiet
if [[ $? -eq 1 ]]; then
git add .
git commit -m "Deploy to gh-pages: ${{ github.sha }}"
git push origin gh-pages
fi
- name: Checkout main branch
uses: actions/checkout@v4