Skip to content

Commit

Permalink
feat(ci): add summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybacon committed Mar 11, 2024
1 parent ff485dd commit d4fe6af
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on: push
# on: push
on:
pull_request:
types: [edited, opened, reopened]

jobs:
lint:
Expand Down Expand Up @@ -53,11 +56,13 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test:coverage
run: pnpm test:coverage >> $GITHUB_STEP_SUMMARY

preview:
name: Preview
# name: Preview
needs: [lint, tests]
outputs:
url: ${{ steps.deploy.outputs.url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -78,7 +83,37 @@ jobs:
- name: Build
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
id: deploy
run: |
url=`vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} >> $GITHUB_STEP_SUMMARY`
echo "url=$url" >> "$GITHUB_OUTPUT"
preview-url:
name: Preview URL
needs: preview
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Log context
uses: actions/github-script@v7
with:
script: |
console.log(context.issue)
console.log(context.repo)
- name: Retrieve preview URL
env:
PREVIEW_URL: ${{needs.preview.outputs.url}}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
body: "Deployed at ${{env.PREVIEW_URL}}",
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
})
release:
name: Release
Expand All @@ -104,4 +139,4 @@ jobs:
- name: Build
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} >> $GITHUB_STEP_SUMMARY

0 comments on commit d4fe6af

Please sign in to comment.