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 14cce94
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
52 changes: 39 additions & 13 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,8 @@ jobs:
node-version-file: 'package.json'
- name: Install dependencies
run: pnpm install --frozen-lockfile
# - name: Lint project
# run: pnpm lint
- name: Lint code
run: |
pnpm lint:code
pnpm lint:format
- name: Check typings
run: pnpm lint:typings
- name: Lint Markdown
run: pnpm lint:wiki
- name: Run lint tasks
run: pnpm lint

tests:
name: Tests
Expand All @@ -53,11 +45,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 @@ -78,7 +72,39 @@ 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 }}`
echo "$url" >> $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(1, github.event.issue)
console.log(2, github.event.issue.pull_request)
console.log(3, github.event.issue.number)
- 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 +130,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
3 changes: 3 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignoreDependencies": ["ts-node"]
}

0 comments on commit 14cce94

Please sign in to comment.