chore: upgrade packages #898
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: ci | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: override release tag | |
required: false | |
push: | |
branches: ['main', 'alpha', 'beta', 'rc'] | |
paths: | |
- 'packages/**' | |
jobs: | |
build: | |
name: Build and Test | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: pnpm/[email protected] | |
with: | |
version: 8 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'pnpm' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install bun | |
uses: oven-sh/setup-bun@v1 | |
- name: Install dependencies | |
run: pnpm install --prefer-offline | |
- uses: dtinth/setup-github-actions-caching-for-turbo@v1 | |
with: | |
# Set the prefix for the cache keys. | |
cache-prefix: kubb_ | |
- name: Build | |
run: bun run build --concurrency=1 | |
- name: Typecheck | |
run: bun run typecheck --concurrency=1 | |
- name: Typecheck examples | |
run: bun run typecheck:examples --concurrency=1 | |
- name: Test | |
run: bun run test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Publish | |
uses: changesets/action@v1 | |
id: publish | |
continue-on-error: true | |
if: ${{ success() && github.event.inputs.tag == '' && github.ref == 'refs/heads/main' && (github.event_name != 'pull_request' || github.event.action == 'closed' && github.event.pull_request.merged == true) }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
with: | |
publish: bun run release | |
- name: Publish ${{ inputs.tag || 'canary' }} | |
continue-on-error: true | |
if: ${{ steps.publish.outputs.published == 'false' || steps.publish.outcome == 'failure' || github.event.inputs.tag != '' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
bun run release:canary --tag ${{ inputs.tag || 'canary' }} | |
- name: Send a discord notification | |
if: steps.publish.outputs.published == 'true' | |
uses: actions/github-script@v6 | |
env: | |
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
fetch(process.env.DISCORD_WEBHOOK_URL, { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ | |
content: `A new release is available 🎉. \n [Read the changelog](https://github.com/kubb-project/kubb/releases)` | |
}), | |
}) | |
.then((res) => { | |
console.log('Sent discord notification', res) | |
}) | |
.catch((err) => { | |
console.error('Error sending discord notification', err) | |
}) |