-
Notifications
You must be signed in to change notification settings - Fork 1
189 lines (162 loc) · 4.98 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# name: Deploy Docusaurus Site
# on:
# push:
# branches:
# - main # or the branch where your website source code resides
# jobs:
# deploy:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: 18 # specify the Node.js version you're using
# - name: Install dependencies
# working-directory: ./docs # Change this if necessary
# run: |
# npm ci
# # npm ci # or npm install if package-lock.json is not present
# - name: Build Docusaurus site
# working-directory: ./docs
# run: npm run build
# - name: Check if CNAME exists and create it if missing
# run: |
# if [ ! -f ./docs/build/CNAME ]; then
# echo "acslstack.com" > ./docs/build/CNAME
# fi
# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/build
# cname: acslstack.com # Add your custom domain here
# name: Deploy to GitHub Pages
# on:
# pull_request:
# branches: [main]
# push:
# branches: [main]
# permissions:
# contents: write
# jobs:
# test-deploy:
# if: github.event_name != 'push'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - uses: actions/setup-node@v4
# with:
# cache-dependency-path: ./docs
# node-version: 18
# cache: npm
# - name: Install dependencies
# working-directory: ./docs
# run: npm ci
# - name: Test build website
# working-directory: ./docs
# run: npm run build
# deploy:
# if: github.event_name != 'pull_request'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - uses: actions/setup-node@v4
# with:
# cache-dependency-path: ./docs
# node-version: 18
# cache: npm
# - uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
# - name: Deploy to GitHub Pages
# env:
# USE_SSH: true
# working-directory: ./docs
# run: |
# # git config --global user.email "[email protected]"
# # git config --global user.name "gh-actions"
# npm ci
# npm run deploy
name: Deploy to GitHub Pages
defaults:
run:
shell: bash
working-directory: ./docs
on:
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
cache-dependency-path: ./docs
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build
- name: List Current Directory
run: |
echo "Current Directory:"
pwd
echo "List Files:"
ls -la
# - name: List Files in Build Directory
# run: |
# echo "List Files in ./build:"
# ls -la ./build || echo "Directory ./build does not exist"
- name: List Files in Build Directory
run: |
echo "List Files in ./build and its subdirectories:"
if [ -d ./build ]; then
find ./build -type f -exec ls -la {} +
else
echo "Directory ./build does not exist"
fi
- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/build
deploy:
name: Deploy to GitHub Pages
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# - name: Deploy to gh-pages branch
# run: |
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git fetch
# git checkout -b gh-pages
# git rm -rf . || true
# cp -r ./docs/build/* .
# git add .
# git commit -m "Deploy to GitHub Pages"
# git push --force origin gh-pages