-
Notifications
You must be signed in to change notification settings - Fork 28
141 lines (124 loc) · 3.94 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: github pages
on:
push:
branches: ["main"]
repository_dispatch:
workflow_dispatch:
# schedule: ## Run at 12.am daily to check for broken links automatically
# - cron: '0 0 * * *'
permissions:
contents: read
pages: write
id-token: write
pull-requests: write
concurrency:
group: "pages"
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-22.04
env:
HUGO_VERSION: 0.139.3
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
- name: Set baseURL
run: sed -i "s|https://www.neurodesk.org/|${{ steps.pages.outputs.base_url }}/|g" config.toml
- name: Install dependencies
run: |
npm install
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
echo "BASEURL=${{ steps.pages.outputs.base_url }}"
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Add custom domain
if: github.repository == 'NeuroDesk/neurodesk.github.io'
run: cp ./static/CNAME ./public/CNAME
- name: Upload artifact
uses: actions/[email protected]
with:
path: ./public
check-links:
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v4
- name: Run linkspector
uses: umbrelladocs/action-linkspector@v1
with:
fail_on_error: true
reporter: github-check
config_file: .linkspector.yml
filter_mode: nofilter
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: check-links
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# - name: Algolia crawler creation and crawl
# uses: algolia/[email protected]
# id: algolia_crawler
# with: # mandatory parameters
# crawler-user-id: ${{ secrets.CRAWLER_USER_ID }}
# crawler-api-key: ${{ secrets.CRAWLER_API_KEY }}
# algolia-app-id: ${{ secrets.ALGOLIA_APP_ID }}
# algolia-api-key: ${{ secrets.ALGOLIA_API_KEY }}
# site-url: 'https://www.neurodesk.org'
# check-links:
# runs-on: ubuntu-latest
# needs: deploy
# steps:
# - uses: actions/checkout@v4
# - name: Setup Pages
# id: pages
# uses: actions/configure-pages@v2
# - name: Create config file
# run: |
# echo ${{ steps.pages.outputs.base_url }}
# echo '{
# "replacementPatterns": [
# {
# "pattern": "^/",
# "replacement": "${{ steps.pages.outputs.base_url }}/"
# }
# ],
# "ignorePatterns": [
# {
# "pattern": "^https://twitter.com"
# },
# {
# "pattern": "^http://localhost"
# }
# ],
# "aliveStatusCodes": [429, 403, 200]
# }' > .github/workflows/config.json
# cat .github/workflows/config.json
# - uses: gaurav-nelson/github-action-markdown-link-check@v1
# # checks all markdown files from content/en including all subfolders
# with:
# use-quiet-mode: 'yes'
# use-verbose-mode: 'no'
# config-file: '.github/workflows/config.json'
# folder-path: 'content/en/'