forked from polkadot-api/polkadot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (100 loc) · 3.14 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
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
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/json-rpc-provider
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/utils
- uses: actions/upload-artifact@v3
with:
name: package
path: ./packages/cli/*.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/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/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 }}