Skip to content

Commit

Permalink
Merge pull request #15 from long-woo/dev
Browse files Browse the repository at this point in the history
feat: 增加发布到 npmjs 的 action
  • Loading branch information
long-woo committed Jul 22, 2023
2 parents 98ed9a4 + 3f918c5 commit bb4aa10
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Package to npmjs

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v1.1.2
with:
deno-version: v1.x

# 使用 dtn 打包
- name: 构建成 npm 包
run: |
deno task build:npm
# 进入发布目录
cd npm_dist
# Setup .npmrc file to publish to npm
- name: 发布到 npmjs
uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ stc --url=https://petstore3.swagger.io/api/v3/openapi.json --outDir=out

```ts
// 引用模块
import { start } from 'https://deno.land/x/stc@1.0.0/mod.ts'
import { start } from 'https://deno.land/x/stc@1.1.4/mod.ts'

// 定义插件
const myPlugin: IPlugin = {
Expand Down
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "1.1.3",
"version": "1.1.4",
"tasks": {
"dev": "deno run -A --watch=src src/main.ts --url 'http://127.0.0.1:4523/export/openapi/7?version=3.1' --tag=2 --outDir=out",
"version": "echo '1.1.3' > release/version",
"version": "echo '1.1.4' > release/version",
"build:npm": "deno run -A src/npm/index.ts",
"build:mac": "deno compile -A src/main.ts --output release/stc --target x86_64-apple-darwin",
"build:mac-m": "deno compile -A src/main.ts --output release/stc-m --target aarch64-apple-darwin",
Expand Down
2 changes: 1 addition & 1 deletion src/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@loongwoo/stc",
"version": "1.1.3",
"version": "1.1.4",
"description": "Swagger 文档转换为接口文件",
"main": "script/cli.js",
"module": "esm/cli.js",
Expand Down

0 comments on commit bb4aa10

Please sign in to comment.