From ff8627c65884a54099b0dfe7e180b8a0769489ca Mon Sep 17 00:00:00 2001 From: SegaraRai Date: Mon, 6 Jan 2025 03:15:55 +0900 Subject: [PATCH] automate release --- .changeset/tough-camels-provide.md | 5 +++ .github/workflows/publish.yml | 50 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 4 --- package.json | 2 ++ 4 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 .changeset/tough-camels-provide.md create mode 100644 .github/workflows/publish.yml diff --git a/.changeset/tough-camels-provide.md b/.changeset/tough-camels-provide.md new file mode 100644 index 0000000..b84829d --- /dev/null +++ b/.changeset/tough-camels-provide.md @@ -0,0 +1,5 @@ +--- +"fraci": minor +--- + +Automate release. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7e7b9bb --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish + +on: + push: + branches: + - main + +permissions: + contents: write + issues: write + pull-requests: write + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Build + run: bun run build + + - name: Type check + run: bun run typecheck + + - name: Test + run: bun test + + - name: Package type check + run: bun run attw + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + version: bun run changeset-version + publish: bun run changeset-publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: "true" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd4ac84..cfe9c89 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,6 @@ name: Test on: pull_request: - push: - branches: - - main permissions: contents: read @@ -12,7 +9,6 @@ permissions: jobs: test: runs-on: ubuntu-latest - timeout-minutes: 10 steps: diff --git a/package.json b/package.json index 7e97fc2..3329bfe 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "author": "SegaraRai", "repository": "https://github.com/SegaraRai/fraci.git", "scripts": { + "changeset-version": "changeset version", + "changeset-publish": "bun publish && git push --follow-tags", "build": "tsup && bun run ./fix-dts.ts", "test": "bun test", "typecheck": "tsc --noEmit",