-
Notifications
You must be signed in to change notification settings - Fork 2.2k
90 lines (76 loc) · 2.84 KB
/
Copy pathwebsite.yml
File metadata and controls
90 lines (76 loc) · 2.84 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
89
90
name: website
on:
push:
branches:
- '*-release'
workflow_dispatch:
concurrency: website-gh-pages
jobs:
check_branch:
runs-on: ubuntu-latest
outputs:
should_deploy: ${{ steps.deploy_config.outputs.should_deploy }}
target_folder: ${{ steps.deploy_config.outputs.target_folder }}
website_base_url: ${{ steps.deploy_config.outputs.website_base_url }}
steps:
- name: Get version
id: get_version
run: |
LATEST=$(npm show deck.gl@latest version | grep -o -E "^[0-9]+\.[0-9]+")
echo "latest=${LATEST}-release" >> "$GITHUB_OUTPUT"
- name: Resolve deploy config
id: deploy_config
env:
LATEST_RELEASE_BRANCH: ${{ steps.get_version.outputs.latest }}
run: |
if [ "${GITHUB_REF_NAME}" = "master" ]; then
echo "should_deploy=true" >> "$GITHUB_OUTPUT"
echo "target_folder=next" >> "$GITHUB_OUTPUT"
echo "website_base_url=/next/" >> "$GITHUB_OUTPUT"
elif [ "${GITHUB_REF_NAME}" = "${LATEST_RELEASE_BRANCH}" ]; then
echo "should_deploy=true" >> "$GITHUB_OUTPUT"
echo "target_folder=" >> "$GITHUB_OUTPUT"
echo "website_base_url=/" >> "$GITHUB_OUTPUT"
else
echo "should_deploy=false" >> "$GITHUB_OUTPUT"
echo "target_folder=" >> "$GITHUB_OUTPUT"
echo "website_base_url=/" >> "$GITHUB_OUTPUT"
fi
deploy:
runs-on: ubuntu-latest
needs: check_branch
permissions:
contents: write
if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_deploy }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Enable Corepack
run: corepack enable yarn
- name: Install dependencies
run: |
yarn bootstrap
(cd website && yarn)
- name: Build website
env:
MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
GoogleMapsAPIKey: ${{ secrets.GOOGLE_MAPS_API_KEY }}
GoogleMapsMapId: ${{ secrets.GOOGLE_MAPS_MAP_ID }}
WEBSITE_BASE_URL: ${{ needs.check_branch.outputs.website_base_url }}
run: (cd website && yarn build)
- name: Deploy
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # 4.8.0
with:
token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}
branch: gh-pages
folder: website/build
target-folder: ${{ needs.check_branch.outputs.target_folder }}
clean: true
clean-exclude: |
next