-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5996f95
commit 84b51f2
Showing
2 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
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 [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@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 | ||
recreate: true | ||
message: | | ||
## 🚀 Deployment Update | ||
The preview of your changes has been successfully deployed! 🎉 | ||
### 🌐 Website Preview | ||
https://tiktok.github.io/sparo/_preview/pr-${{ github.event.number }}/ | ||
Please review the changes at the above link. If everything looks good, you can proceed with the merge. If you encounter any issues, please address them and push the changes. | ||
Happy coding! 😃 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters