From e5d5c113cc1e29bdac80d157854215bbc9f07078 Mon Sep 17 00:00:00 2001 From: adnpark Date: Tue, 16 Jan 2024 15:53:28 +0900 Subject: [PATCH] ci: improve ci --- .changeset/README.md | 8 +++ .changeset/config.json | 11 ++++ .../actions/install-dependencies/action.yml | 12 ++++ .github/workflows/build.yml | 19 ------ .github/workflows/on-pull-request.yml | 32 ++++++++++ .github/workflows/on-push-to-main.yml | 60 ++++++++++++++++++ .github/workflows/verify.yml | 44 +++++++++++++ bun.lockb | Bin 152373 -> 152373 bytes package.json | 7 +- 9 files changed, 172 insertions(+), 21 deletions(-) create mode 100644 .changeset/README.md create mode 100644 .changeset/config.json create mode 100644 .github/workflows/actions/install-dependencies/action.yml delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/on-pull-request.yml create mode 100644 .github/workflows/on-push-to-main.yml create mode 100644 .github/workflows/verify.yml diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000..e5b6d8d --- /dev/null +++ b/.changeset/README.md @@ -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) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..fce1c26 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.github/workflows/actions/install-dependencies/action.yml b/.github/workflows/actions/install-dependencies/action.yml new file mode 100644 index 0000000..9dd9fb4 --- /dev/null +++ b/.github/workflows/actions/install-dependencies/action.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 96889e4..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: build -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - name: build - runs-on: ubuntu-latest - steps: - # ... - - uses: actions/checkout@v3 - - uses: oven-sh/setup-bun@v1 - - # run any `bun` or `bunx` command - - run: bun install - - run: bun run build diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml new file mode 100644 index 0000000..b6ec924 --- /dev/null +++ b/.github/workflows/on-pull-request.yml @@ -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 diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml new file mode 100644 index 0000000..6ebede1 --- /dev/null +++ b/.github/workflows/on-push-to-main.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 0000000..c282ef1 --- /dev/null +++ b/.github/workflows/verify.yml @@ -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 \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 0a220ba4d9279296cd4015cf18f0602eef3fe7fb..b3df15daef22b9d0a435da6b277f3775bb5baa1d 100755 GIT binary patch delta 26 dcmdnGjC1QU&W0_F{xdn47$9JK_)NxoI{|cf2rmEt delta 26 icmdnGjC1QU&W0_F{xdlk