Skip to content

Website preview deployment #2

Website preview deployment

Website preview deployment #2

name: Website preview deployment
on:
pull_request:
branches:
- main
paths:
- .github/workflows/website-preview-deploy.yaml
- apps/website/**
jobs:
preview-deploy:
name: Preview deployment
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@4
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 [email protected]
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@4
with:
node-version: 18
- name: Rush Install(Website)
run: node common/scripts/install-run-rush.js install --to website
- name: Rush build(Website)
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
publish_branch: preview-${{ github.head_ref }}
- name: Comment on the pull request with preview URL
if: github.event_name == 'pull_request'
uses: peter-evans/commit-comment@v2
with:
body: 'Preview URL: https://tiktok.github.io/sparo/preview-${{ github.head_ref }}/'