-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (40 loc) · 1.51 KB
/
deploy.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
name: Deploy to gh-pages
on:
workflow_run:
workflows:
- CI
types:
- completed
workflow_dispatch:
jobs:
gh-deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success'
permissions:
contents: write
steps:
- name: Checking Out
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Prepare github pages
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
LATEST_HASH=$(git rev-parse --short=7 HEAD)
git clone https://github.com/ittuann/Route2CIDR.git pages
cd pages
git checkout gh-pages
if [[ "$(git ls-files)" ]]; then git rm -rf .; fi
git clean -fxd
cp ../index.html .
cp -r ../dist ./dist
cp -r ../iconx ./iconx
git add .
git commit -s -m "Deployed GitHub Pages - $LATEST_HASH"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: pages