update dist dir #3
Workflow file for this run
This file contains hidden or 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
| name: Vercel Preview Deployment | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| on: | |
| push: | |
| branches-ignore: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| Deploy-Preview: | |
| name: Deploy to Vercel Preview Hosting | |
| runs-on: ubuntu-latest | |
| outputs: | |
| preview_url: ${{ steps.preview-deployment.outputs.preview_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup | |
| uses: ./.github/setup | |
| - name: Install Vercel CLI | |
| run: pnpm add -g vercel@latest | |
| - name: Pull Vercel Environment Information | |
| run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Build Project Artifacts | |
| run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Deploy Project Artifacts to Vercel for Preview | |
| id: preview-deployment | |
| run: | | |
| preview_url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}) | |
| echo "preview_url=$preview_url" >> "$GITHUB_OUTPUT" | |
| Github-Deployment: | |
| name: Create Github Deployment for Preview Environment | |
| runs-on: ubuntu-latest | |
| needs: Deploy-Preview | |
| permissions: | |
| deployments: write | |
| steps: | |
| - name: Add Failed Preview Deployment | |
| id: preview-deployment-failure | |
| if: ${{ needs.Deploy-Preview.result == 'failure' }} | |
| uses: chrnorm/[email protected] | |
| with: | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| initial-status: "failure" | |
| environment-url: ${{ needs.Deploy-Preview.outputs.preview_url }} | |
| environment: preview | |
| - name: Add Successful Preview Deployment | |
| id: preview-deployment-success | |
| if: ${{ needs.Deploy-Preview.result == 'success' }} | |
| uses: chrnorm/[email protected] | |
| with: | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| initial-status: "success" | |
| environment-url: ${{ needs.Deploy-Preview.outputs.preview_url }} | |
| environment: preview | |
| PR-Comment: | |
| name: Comment on Pull Requests Based on Vercel Deployment Success | |
| if: ${{ github.event_name == 'pull_request' }} | |
| runs-on: ubuntu-latest | |
| needs: Deploy-Preview | |
| steps: | |
| - name: Finding Pull Request ID | |
| id: pr_id_finder | |
| uses: jwalton/[email protected] | |
| with: | |
| github-token: ${{ secrets.CHANGESETS_TOKEN }} | |
| - name: Add PR Comment for Vercel Deployment Failure | |
| if: ${{ steps.pr_id_finder.outputs.pr && needs.Deploy-Preview.result == 'failure' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.CHANGESETS_TOKEN }} | |
| PR_ID: ${{ steps.pr_id_finder.outputs.pr }} | |
| run: | | |
| gh pr comment $PR_ID --body "Deployment Failure" | |
| - name: Add PR Comment for Vercel Deployment Success | |
| if: ${{ steps.pr_id_finder.outputs.pr && needs.Deploy-Preview.result == 'success' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.CHANGESETS_TOKEN }} | |
| PR_ID: ${{ steps.pr_id_finder.outputs.pr }} | |
| run: | | |
| gh pr comment $PR_ID --body "Deployment Success; Changes available at ${{ needs.Deploy-Preview.outputs.preview_url }}" |