forked from polkadot-api/polkadot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (127 loc) · 4.11 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_dispatch:
jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/[email protected]
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install deps
run: pnpm install
- name: Build
run: pnpm build
- name: Run lint
run: pnpm lint
- name: Run tests
run: pnpm test
- name: Run Integration Tests
run: pnpm test:ci
publish:
if: contains(fromJSON('["push", "pull_request"]'), github.event_name)
needs: build
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Install deps
run: pnpm install
- name: Build
run: pnpm build
- name: Pack
run: |
pnpm dlx lerna init
pnpm dlx lerna version prerelease --no-git-tag-version --yes --exact --preid ${{ github.sha }}.${{ github.run_attempt }}
pnpm pack --dir packages/cli
pnpm pack --dir packages/client
pnpm pack --dir packages/json-rpc-provider
pnpm pack --dir packages/json-rpc-provider-proxy
pnpm pack --dir packages/legacy-polkadot-provider
pnpm pack --dir packages/light-client-extension-helpers
pnpm pack --dir packages/sc-provider
pnpm pack --dir packages/substrate-bindings
pnpm pack --dir packages/substrate-client
pnpm pack --dir packages/substrate-codegen
pnpm pack --dir packages/tx-helper
pnpm pack --dir packages/utils
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/cli/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/client/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/json-rpc-provider/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/json-rpc-provider-proxy/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/legacy-polkadot-provider/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/light-client-extension-helpers/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/sc-provider/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/substrate-bindings/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/substrate-client/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/substrate-codegen/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/tx-helper/*.tgz
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/utils/*.tgz
- name: NPM Publish automation
uses: octokit/[email protected]
with:
route: POST /repos/paritytech/npm_publish_automation/actions/workflows/publish.yml/dispatches
ref: main
inputs: '${{ format(''{{ "repo": "{0}", "run_id": "{1}", "npm_tag": "{2}" }}'', github.repository, github.run_id, github.ref_name == ''main'' && ''next'' || format(''pr-{0}'', github.event.number)) }}'
env:
GITHUB_TOKEN: ${{ secrets.NPM_PUBLISH_AUTOMATION_TOKEN }}