Skip to content

Commit

Permalink
ci: improve ci
Browse files Browse the repository at this point in the history
  • Loading branch information
adnpark committed Jan 16, 2024
1 parent 4c9a493 commit e5d5c11
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 21 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
12 changes: 12 additions & 0 deletions .github/workflows/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Install dependencies"
description: "Prepare repository and all dependencies"

runs:
using: "composite"
steps:
- name: Set up Bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies
shell: bash
run: bun install --ignore-scripts
19 changes: 0 additions & 19 deletions .github/workflows/build.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Pull Request
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

size:
name: Size
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Report bundle size
uses: andresz1/size-limit-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
package_manager: bun
60 changes: 60 additions & 0 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Main
on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

changesets:
name: Changesets
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Create Version Pull Request
uses: changesets/action@v1
with:
version: bun run changeset:version
commit: 'chore: version package'
title: 'chore: version package'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Publish to NPM
uses: changesets/action@v1
with:
publish: bun run changeset:release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Verify
on:
workflow_call:
workflow_dispatch:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Lint code
run: bun format && bun lint:fix

- uses: stefanzweifel/git-auto-commit-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'chore: format'
commit_user_name: 'github-actions[bot]'
commit_user_email: 'github-actions[bot]@users.noreply.github.com'

build:
name: Build
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Build
run: bun run build
Binary file modified bun.lockb
Binary file not shown.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
"type": "module",
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"changeset": "changeset",
"changeset:release": "bun run build && changeset publish",
"changeset:version": "changeset version && bun install --lockfile-only",
"dev": "ts-node src/index.ts",
"format": "biome format ./src --write",
"lint": "biome check ./src",
"lint:fix": "bun run lint --apply"
"lint:fix": "bun run lint --apply",
"start": "node dist/index.js"
},
"bin": {
"zerodev": "./dist/index.js"
Expand Down

0 comments on commit e5d5c11

Please sign in to comment.