-
Notifications
You must be signed in to change notification settings - Fork 3
105 lines (92 loc) · 2.79 KB
/
gh-pages.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: github pages
on:
push:
branches:
- main # Set a branch to deploy
schedule:
- cron: '30 0 * * *'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
run: hugo --minify
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
working-directory: ./themes/aoepeople.github.io
- name: Build Tailwind
run: npm run build
working-directory: ./themes/aoepeople.github.io
# run again to include updated theme stylesheets after tailwind
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build
if: github.ref == 'refs/heads/main'
run: hugo --minify
- name: Build Preview
if: github.event_name == 'pull_request'
run: hugo --minify -b https://opensource.aoe.com/_preview-opensource/${{ github.head_ref }} -e preview
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: public
path: public
deploy:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
needs: build
environment:
name: opensource.aoe.com
url: https://opensource.aoe.com/
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: public
path: public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: opensource.aoe.com
deploy-preview:
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
needs: build
environment:
name: _preview-opensource/${{ github.head_ref }}
url: https://opensource.aoe.com/_preview-opensource/${{ github.head_ref }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: public
path: public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.PREVIEW_DEPLOY_KEY }}
external_repository: aoepeople/_preview-opensource
publish_branch: gh-pages
publish_dir: ./public
destination_dir: ${{ github.head_ref }}