Skip to content

feat: Add workflow for PR preview deployment #8

feat: Add workflow for PR preview deployment

feat: Add workflow for PR preview deployment #8

Workflow file for this run

name: PR Preview
on:
pull_request:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Set ARCO_SITE_DOMAIN
run: echo "ARCO_SITE_DOMAIN=preview-${{ github.event.number }}-arco-design-mobile.surge.sh" >> $GITHUB_ENV
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: PR Preview Link
- name: Get Current Time
run: echo "CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
- name: Comment PR with Preview Link
uses: peter-evans/create-or-update-comment@v2
env:
ARCO_SITE_DOMAIN: ${{ env.ARCO_SITE_DOMAIN }}
CURRENT_TIME: ${{ env.CURRENT_TIME }}
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: |
✨ **PR Preview Link**: [https://${{ env.ARCO_SITE_DOMAIN }}](https://${{ env.ARCO_SITE_DOMAIN }})
🕒 **Current Time**: ${{ env.CURRENT_TIME }}