removed env #4
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
name: Preview Deploy | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
on: | |
push: | |
branches-ignore: | |
- main | |
pull_request: | |
types: [opened] | |
jobs: | |
preview-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
deployments: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: chrnorm/deployment-action@v2 | |
name: Create GitHub deployment | |
id: deployment | |
with: | |
token: '${{ github.token }}' | |
environment: preview | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Install dependencies | |
run: yarn install | |
- 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 | |
id: vercel-deploy | |
run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT | |
- name: Update GitHub Deployment Status (success) | |
if: success() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: '${{ github.token }}' | |
environment-url: ${{ steps.vercel-deploy.outputs.url }} | |
state: 'success' | |
deployment-id: ${{ steps.deployment.outputs.deployment_id }} | |
- name: Find Pull Request | |
if: success() | |
uses: juliangruber/find-pull-request-action@v1 | |
id: find-pull-request | |
with: | |
branch: ${{ github.ref_name }} | |
- name: write deployment comment (in PR) | |
if: success() && steps.find-pull-request.outputs.number | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: ${{ steps.find-pull-request.outputs.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Preview URL: ' + '${{ steps.vercel-deploy.outputs.url }}' | |
}) | |
- name: Update GitHub Deployment Status (failure) | |
if: failure() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: '${{ github.token }}' | |
state: 'failure' | |
deployment-id: ${{ steps.deployment.outputs.deployment_id }} |