This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (89 loc) Β· 2.99 KB
/
documentation.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
name: documentation
on:
pull_request:
branches: [dev]
push:
branches: [dev]
jobs:
secrets-gate:
runs-on: ubuntu-latest
outputs:
ok: ${{ steps.check-secrets.outputs.ok }}
steps:
- name: check for secrets needed to run workflows
id: check-secrets
run: |
if [ ${{ secrets.DOCUMENTATION_BUILD_ENABLED }} == 'true' ]; then
echo "ok=enabled" >> $GITHUB_OUTPUT
fi
checks:
if: github.event_name != 'push'
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max_old_space_size=8192
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Config npm registry token
run: npm config set '//npm.pkg.github.com/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: install main repository
run: npm install --legacy-peer-deps
- name: clone etherealengine docs
run: git clone https://github.com/etherealengine/etherealengine-docs.git docs
- name: install docs npm packages
working-directory: docs
run: npm install --legacy-peer-deps
- name: build docs
working-directory: docs
run: |
cp .env.local.default .env.local
npm run build
gh-release:
needs:
- secrets-gate
if: ${{ needs.secrets-gate.outputs.ok == 'enabled' && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
- name: Config github npm registry token
run: npm config set '//npm.pkg.github.com/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release to GitHub Pages
timeout-minutes: 200
env:
NODE_OPTIONS: --max_old_space_size=16384
USE_SSH: true
GIT_USER: git
DEPLOYMENT_BRANCH: gh-pages
run: |
git config --global user.email "[email protected]"
git config --global user.name "gh-actions"
npm install --legacy-peer-deps
git clone [email protected]:etherealengine/etherealengine-docs.git docs
echo "Starting to remove commit history for gh-pages branch"
cd docs
latestMainCommit=$(git rev-parse HEAD)
git checkout gh-pages
git checkout --orphan temp-gh-pages
git add -A
git commit -m "Deploy website - based on ${latestMainCommit}"
git checkout gh-pages
git reset --hard temp-gh-pages
git push origin gh-pages --force
git branch -D temp-gh-pages
echo "gh-pages commit history has been cleared"
git checkout main
cp .env.local.default .env.local
npm install --legacy-peer-deps
npm run deploy