Repository navigation
88 lines (82 loc) · 3.21 KB
/
Copy pathwebsite.yml
File metadata and controls
88 lines (82 loc) · 3.21 KB
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
name: Website
on:
pull_request:
paths:
- 'website/**'
- 'scripts/build-website.sh'
- 'tests/browser/engine.mjs'
- 'docs/guides/assets/dota2-short-film-canvas.jpg'
- 'docs/guides/assets/dota2-short-film.mp4'
- '.github/workflows/website.yml'
push:
branches: [main]
paths:
- 'website/**'
- 'scripts/build-website.sh'
- 'tests/browser/engine.mjs'
- 'docs/guides/assets/dota2-short-film-canvas.jpg'
- 'docs/guides/assets/dota2-short-film.mp4'
- '.github/workflows/website.yml'
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: website-${{ github.ref }}
cancel-in-progress: false
jobs:
refresh-downloads:
if: github.event_name == 'release' && github.repository == 'ThinkFlowLab/OpenDirector' && !github.event.release.prerelease
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Start the Pages build on main
env:
GH_TOKEN: ${{ github.token }}
run: gh api --method POST "repos/$GITHUB_REPOSITORY/actions/workflows/website.yml/dispatches" -f ref=main
build:
if: github.event_name != 'release'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: ${{ github.ref == 'refs/heads/main' && 'main' || github.sha }}
persist-credentials: false
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version-file: .nvmrc
- run: node --test website/installers.test.mjs
- name: Build the website with published downloads
env:
GITHUB_TOKEN: ${{ github.token }}
run: bash scripts/build-website.sh "$RUNNER_TEMP/pages/OpenDirector"
- name: Check the built site in Chromium
run: |
npm install --prefix "$RUNNER_TEMP/browser" --no-save --no-package-lock playwright-core@1.58.2
export PLAYWRIGHT_MODULE="$RUNNER_TEMP/browser/node_modules/playwright-core/index.mjs"
node "$RUNNER_TEMP/browser/node_modules/playwright-core/cli.js" install --with-deps --only-shell chromium
python3 -m http.server 8780 --bind 127.0.0.1 --directory "$RUNNER_TEMP/pages" &
server=$!
trap 'kill "$server"' EXIT
curl -fsS --retry 5 --retry-connrefused http://127.0.0.1:8780/OpenDirector/ -o /dev/null
node website/site.test.mjs
- if: github.repository == 'ThinkFlowLab/OpenDirector' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: ${{ runner.temp }}/pages/OpenDirector
deploy:
if: github.repository == 'ThinkFlowLab/OpenDirector' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1