Skip to content

Commit

Permalink
feat: Add GitHub workflow for publishing package
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ryoppippi committed Jun 11, 2024
1 parent d6f6e31 commit 6c32126
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/jsr.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion packages/unplugin-typia/jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ryoppippi/unplugin-typia",
"version": "0.3.10",
"version": "0.0.0",
"exports": {
".": "./src/index.ts",
"./api": "./src/api.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/unplugin-typia/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 6c32126

Please sign in to comment.