-
Notifications
You must be signed in to change notification settings - Fork 11
57 lines (57 loc) · 2.11 KB
/
website-preview-deploy.yaml
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
name: Website preview deployment
on:
pull_request:
branches:
- main
paths:
- .github/workflows/website-preview-deploy.yaml
- apps/website/**
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
preview-deploy:
name: Preview deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
env:
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
run: |
git config --local user.name tiktokbot
git config --local user.email tiktokbot@users.noreply.github.com
git config --global credential.helper '!f() { echo "protocol=https\nhost=github.com" ; echo "username=oauth_token" ; echo "password=${GITHUB_TOKEN}" ; }; f'
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Set environment variable
run: echo "BASE_URL=/sparo/_preview/pr-${{ github.event.number }}/" >> $GITHUB_ENV
- name: Rush Install(Website)
run: node common/scripts/install-run-rush.js install --to website
- name: Rush build(Website)
env:
BASE_URL: ${{ env.BASE_URL }}
run: node common/scripts/install-run-rush.js build --verbose --production --to website
- name: Deploy to GitHub Pages preview
uses: peaceiris/actions-gh-pages@v4
if: github.event_name == 'pull_request'
with:
github_token: ${{ secrets.BOT_ACCESS_TOKEN }}
publish_dir: ./apps/website/build
destination_dir: _preview/pr-${{ github.event.number }}
- name: Comment on the pull request with preview URL
if: github.event_name == 'pull_request'
uses: hasura/comment-progress@v2
with:
github-token: ${{ secrets.BOT_ACCESS_TOKEN }}
repository: 'tiktok/sparo'
number: ${{ github.event.number }}
id: deploy-preview
message: 'Website Preview: https://tiktok.github.io/sparo/_preview/pr-${{ github.event.number }}/'
recreate: true