From 6c3212653e925eb1c2a1da33552a32c5adceddc2 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:17:52 +0100 Subject: [PATCH] feat: Add GitHub workflow for publishing package This commit introduces a new GitHub workflow named 'jsr'. This workflow is triggered on push events for tags and on workflow dispatch. It sets up the environment with the latest version of 'bun', installs dependencies, fetches the version from the tag, updates the version in package.json and jsr.json, and finally publishes the package if the ref is a version tag. --- .github/workflows/jsr.yaml | 35 ++++++++++++++++++++++++++++ packages/unplugin-typia/jsr.json | 2 +- packages/unplugin-typia/package.json | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/jsr.yaml diff --git a/.github/workflows/jsr.yaml b/.github/workflows/jsr.yaml new file mode 100644 index 00000000..fac49bed --- /dev/null +++ b/.github/workflows/jsr.yaml @@ -0,0 +1,35 @@ +name: jsr + +on: + push: + tags: + - "*" + workflow_dispatch: + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - run: bun i --frozen-lockfile + - id: get_version + name: Get version + uses: jannemattila/get-version-from-tag@v3 + - name: jsr.json version to packge.json verion + run: | + jq --arg new_version "${{ steps.get_version.outputs.version }}" '.version = $new_version' package.json > package.tmp.json && mv package.tmp.json package.json + jq --arg new_version "${{ steps.get_version.outputs.version }}" '.version = $new_version' jsr.json > jsr.tmp.json && mv jsr.tmp.json jsr.json + working-directory: packages/unplugin-typia + - name: Publish + if: github.ref == 'refs/tags/v*' + run: bun run publish + working-directory: packages/unplugin-typia diff --git a/packages/unplugin-typia/jsr.json b/packages/unplugin-typia/jsr.json index ed373d8e..1ec28052 100644 --- a/packages/unplugin-typia/jsr.json +++ b/packages/unplugin-typia/jsr.json @@ -1,6 +1,6 @@ { "name": "@ryoppippi/unplugin-typia", - "version": "0.3.10", + "version": "0.0.0", "exports": { ".": "./src/index.ts", "./api": "./src/api.ts", diff --git a/packages/unplugin-typia/package.json b/packages/unplugin-typia/package.json index 7d5da540..60fbefed 100644 --- a/packages/unplugin-typia/package.json +++ b/packages/unplugin-typia/package.json @@ -1,7 +1,7 @@ { "name": "@ryoppippi/unplugin-typia", "type": "module", - "version": "0.3.10", + "version": "0.0.0", "description": "unplugin for typia", "author": "ryoppippi", "license": "MIT",