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 1f1aa8e
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,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
needs: [lint, tests]
outputs:
url: ${{ steps.deploy.outputs.url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -76,9 +78,43 @@ jobs:
npm install --global vercel@latest
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
run: |
echo "::group::Vercel build"
vercel build --token=${{ secrets.VERCEL_TOKEN }}
echo "::endgroup::"
- 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:
needs: preview
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Log context
uses: actions/github-script@v7
with:
script: |
echo "::group::Context content"
console.log(context.issue)
console.log(context.repo)
echo "::groupend::"
- 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 +140,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 1f1aa8e

Please sign in to comment.