Skip to content

Commit

Permalink
Update Deploy Preview.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rLukoyanov authored Aug 7, 2024
1 parent 2c7f4d3 commit b0a498b
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/Deploy Preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
build:
build-and-deploy:
runs-on: ubuntu-latest

steps:
Expand All @@ -29,4 +29,34 @@ jobs:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: npx vercel --prod --token $VERCEL_TOKEN --confirm
run: |
npx vercel --prod --token $VERCEL_TOKEN --org-id $VERCEL_ORG_ID --project-id $VERCEL_PROJECT_ID --confirm
id: vercel-deploy

- name: Get Vercel Deployment URL
run: echo "Vercel Deployment URL: $(npx vercel --token $VERCEL_TOKEN ls --scope $VERCEL_ORG_ID | grep -o 'https://[^ ]*')" > vercel_url.txt
id: get-url
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

- name: Save Deployment URL as GitHub output
id: save-url
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const url = fs.readFileSync('vercel_url.txt', 'utf8').trim();
core.setOutput('vercel-url', url);
- name: Comment on Pull Request
uses: actions/github-script@v6
with:
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Deployed to Vercel: ${url}`
})
env:
url: ${{ steps.save-url.outputs.vercel-url }}

0 comments on commit b0a498b

Please sign in to comment.