-
Notifications
You must be signed in to change notification settings - Fork 10
58 lines (49 loc) · 1.71 KB
/
build.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
55
56
57
58
name: Build Error Pages
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Go environment
uses: actions/setup-go@v3
with:
go-version: "1.23" # You can change this to the version you need
- name: Copy main.html to templates directory
run: |
rm -rf ./error-pages/templates/*.html
cp main.html ./error-pages/templates/main.html
- name: Run go command to build error pages
run: |
cd error-pages
go run ./cmd/error-pages build --add-template=templates/main.html --index
- name: Archive
run: |
mkdir ./out
zip -r ./out/error-page.zip ./error-pages/main
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: error-pages-static
path: ./out
if-no-files-found: error
retention-days: 7
- name: Ready to deploy
run: |
mkdir ./gh-pages
mkdir ./gh-pages/main
cp -r ./error-pages/main/* ./gh-pages/main/
cp ./error-pages/index.html ./gh-pages/index.html
- uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages