Skip to content

Commit b3008ee

Browse files
authored
Set up publishing (#2)
1 parent 5004a0a commit b3008ee

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
8+
jobs:
9+
publish:
10+
name: Publish
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
20+
- name: Get version
21+
run: |
22+
VERSION=${GITHUB_REF#refs/tags/}
23+
echo Version: $VERSION
24+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
25+
26+
- name: Install pnpm
27+
run: npm install -g pnpm
28+
29+
- name: Install dependencies
30+
run: pnpm install
31+
32+
- name: Compile
33+
run: pnpm build
34+
35+
- name: Update package.json version
36+
run: |
37+
jq --arg version $VERSION '.version = $version' package.json > package.tmp.json
38+
mv package.tmp.json package.json
39+
git diff package.json
40+
41+
- name: Publish
42+
env:
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
run: |
45+
pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
46+
pnpm publish --no-git-checks --access public

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "trpc-openapi-2",
3-
"version": "0.0.1",
2+
"name": "@zachkirsch/trpc-openapi-2",
3+
"version": "",
44
"description": "",
55
"main": "lib/index.js",
66
"files": [

0 commit comments

Comments
 (0)