-
Notifications
You must be signed in to change notification settings - Fork 18
138 lines (138 loc) · 3.92 KB
/
authzed-node.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: authzed-node-ci
on:
push:
branches:
- "main"
pull_request:
branches:
- "*"
merge_group:
types:
- "checks_requested"
release:
types: [published]
jobs:
paths-filter:
runs-on: "buildjet-2vcpu-ubuntu-2204"
outputs:
codechange: "${{ steps.code-filter.outputs.codechange }}"
steps:
- uses: "actions/checkout@v4"
- uses: "dorny/paths-filter@v3"
id: "code-filter"
with:
filters: |
codechange:
- src/**
- .github/workflows/authzed-node.yaml
- package.json
- js-dist/package.json
test:
name: Lint and Test
runs-on: "buildjet-2vcpu-ubuntu-2204"
strategy:
matrix:
node-version: [18, 20, 21]
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true' || github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: "authzed/action-spicedb@v1"
with:
version: "latest"
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --silent
working-directory: ./
- name: Run lint
run: CI=true yarn lint
working-directory: ./
- name: Run Yarn tests
run: CI=true yarn only-run-tests
working-directory: ./
publish-npm:
name: Publish to NPM
needs:
- test
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --silent
working-directory: ./
- run: yarn test
- uses: battila7/get-version-action@v2
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ steps.get_version.outputs.version }}
access: public
build-js-client:
name: Build and Test JS client
runs-on: "buildjet-2vcpu-ubuntu-2204"
strategy:
matrix:
node-version: [18, 20, 21]
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true' || github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: "authzed/action-spicedb@v1"
with:
version: "latest"
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --silent
working-directory: ./
- name: Run build
run: yarn build-js-client
working-directory: ./
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --silent
working-directory: ./js-dist
- name: Run tests
run: CI=true yarn only-run-tests
working-directory: ./js-dist
- uses: actions/upload-artifact@v4
with:
name: js-client-${{ matrix.node-version }}
path: |
js-dist/**
!js-dist/node_modules/**
publish-js-client-npm:
name: Publish JS client to NPM
needs: build-js-client
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Download js client build
uses: actions/download-artifact@v4
with:
name: js-client-18
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --silent
working-directory: ./
- uses: battila7/get-version-action@v2
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ steps.get_version.outputs.version }}
access: public