Skip to content

Commit 863eca8

Browse files
authored
Merge pull request #160 from authzed/version-at-release-time
Set package version at release time
2 parents d7d159b + 6783ab0 commit 863eca8

7 files changed

Lines changed: 303 additions & 1699 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# yamllint disable rule:line-length
3+
name: "Publish to NPM"
4+
on: # yamllint disable-line rule:truthy
5+
release:
6+
types:
7+
- "published"
8+
jobs:
9+
publish:
10+
name: Publish to NPM
11+
needs:
12+
- test
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 18
19+
- uses: bahmutov/npm-install@v1
20+
- run: yarn test
21+
- uses: battila7/get-version-action@v2
22+
# Set the version in package.json to match the tag
23+
- run: "npm version ${{ steps.get_version.outputs.version-without-v }}"
24+
- uses: JS-DevTools/npm-publish@v3
25+
with:
26+
token: ${{ secrets.NPM_TOKEN }}
27+
tag: ${{ steps.get_version.outputs.version }}
28+
access: public
29+
# NOTE: this publishes an alternate version that doesn't depend on protobuf-ts/runtime
30+
publish-js-client:
31+
name: Publish JS client to NPM
32+
needs: build-js-client
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Download js client build
36+
uses: actions/download-artifact@v4
37+
with:
38+
name: js-client-18
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 18
42+
- uses: bahmutov/npm-install@v1
43+
- uses: battila7/get-version-action@v2
44+
# Set the version in package.json to match the tag
45+
- run: "npm version ${{ steps.get_version.outputs.version-without-v }}"
46+
- uses: JS-DevTools/npm-publish@v3
47+
with:
48+
token: ${{ secrets.NPM_TOKEN }}
49+
tag: ${{ steps.get_version.outputs.version }}
50+
access: public
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: authzed-node-ci
1+
name: "Lint and Test"
22
on:
33
push:
44
branches:
@@ -9,8 +9,6 @@ on:
99
merge_group:
1010
types:
1111
- "checks_requested"
12-
release:
13-
types: [published]
1412
jobs:
1513
paths-filter:
1614
runs-on: "buildjet-2vcpu-ubuntu-2204"
@@ -45,38 +43,12 @@ jobs:
4543
- uses: actions/setup-node@v4
4644
with:
4745
node-version: ${{ matrix.node-version }}
46+
cache: "yarn"
4847
- uses: bahmutov/npm-install@v1
49-
with:
50-
install-command: yarn --frozen-lockfile --silent
51-
working-directory: ./
5248
- name: Run lint
5349
run: CI=true yarn lint
54-
working-directory: ./
5550
- name: Run Yarn tests
5651
run: CI=true yarn only-run-tests
57-
working-directory: ./
58-
publish-npm:
59-
name: Publish to NPM
60-
needs:
61-
- test
62-
runs-on: ubuntu-latest
63-
if: github.event_name == 'release'
64-
steps:
65-
- uses: actions/checkout@v4
66-
- uses: actions/setup-node@v4
67-
with:
68-
node-version: 18
69-
- uses: bahmutov/npm-install@v1
70-
with:
71-
install-command: yarn --frozen-lockfile --silent
72-
working-directory: ./
73-
- run: yarn test
74-
- uses: battila7/get-version-action@v2
75-
- uses: JS-DevTools/npm-publish@v3
76-
with:
77-
token: ${{ secrets.NPM_TOKEN }}
78-
tag: ${{ steps.get_version.outputs.version }}
79-
access: public
8052
build-js-client:
8153
name: Build and Test JS client
8254
runs-on: "buildjet-2vcpu-ubuntu-2204"
@@ -94,16 +66,13 @@ jobs:
9466
- uses: actions/setup-node@v4
9567
with:
9668
node-version: ${{ matrix.node-version }}
69+
cache: "yarn"
9770
- uses: bahmutov/npm-install@v1
98-
with:
99-
install-command: yarn --frozen-lockfile --silent
100-
working-directory: ./
10171
- name: Run build
10272
run: yarn build-js-client
10373
working-directory: ./
10474
- uses: bahmutov/npm-install@v1
10575
with:
106-
install-command: yarn --frozen-lockfile --silent
10776
working-directory: ./js-dist
10877
- name: Run tests
10978
run: CI=true yarn only-run-tests
@@ -114,26 +83,3 @@ jobs:
11483
path: |
11584
js-dist/**
11685
!js-dist/node_modules/**
117-
publish-js-client-npm:
118-
name: Publish JS client to NPM
119-
needs: build-js-client
120-
runs-on: ubuntu-latest
121-
if: github.event_name == 'release'
122-
steps:
123-
- name: Download js client build
124-
uses: actions/download-artifact@v4
125-
with:
126-
name: js-client-18
127-
- uses: actions/setup-node@v4
128-
with:
129-
node-version: 18
130-
- uses: bahmutov/npm-install@v1
131-
with:
132-
install-command: yarn --frozen-lockfile --silent
133-
working-directory: ./
134-
- uses: battila7/get-version-action@v2
135-
- uses: JS-DevTools/npm-publish@v3
136-
with:
137-
token: ${{ secrets.NPM_TOKEN }}
138-
tag: ${{ steps.get_version.outputs.version }}
139-
access: public

0 commit comments

Comments
 (0)