-
Notifications
You must be signed in to change notification settings - Fork 1k
63 lines (49 loc) · 2.08 KB
/
debug-client.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
name: Debug client
on:
push:
paths:
- 'client-next/**'
jobs:
debug-client:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# this is necessary so that the correct credentials are put into the git configuration
# when we push to dev-2.x and push the HTML to the git repo
- uses: actions/checkout@v4
if: github.event_name == 'push' && (github.ref == 'refs/heads/debug-client-cdn' || github.ref == 'refs/heads/master')
with:
token: ${{ secrets.CHANGELOG_TOKEN }}
fetch-depth: 0
# for a simple PR where we don't push, we don't need any credentials
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Build debug client
working-directory: client-next
run: |
npm install
npm run build
- name: Deploy compiled assets to repo
if: github.event_name == 'push' && github.ref == 'refs/heads/debug-client-cdn'
env:
REMOTE: debug-client
LOCAL_BRANCH: local-debug-client
REMOTE_BRANCH: main
run: |
git config --global user.name 'OTP Bot'
git config --global user.email '[email protected]'
git remote add $REMOTE https://[email protected]/opentripplanner/debug-client.git
git fetch --depth=1 $REMOTE $REMOTE_BRANCH:$LOCAL_BRANCH
git checkout $LOCAL_BRANCH
version=`date +%Y-%m-%dT%H-%M`
mkdir -p $version
rsync client-next/output/* $version
git add $version
git commit -am "Add newest version ${version} of debug client"
git push $REMOTE $LOCAL_BRANCH:$REMOTE_BRANCH
git checkout dev-2.x
sed 's|/debug-client-next/|https://cdn.jsdelivr.net/gh/opentripplanner/debug-client@main/${version}/|g' <client-next/output/index.html >src/client/debug-client-preview/index.html
cat src/client/debug-client-preview/index.html