-
Notifications
You must be signed in to change notification settings - Fork 29
58 lines (56 loc) · 2.2 KB
/
publish.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
name: publish
on:
push:
tags:
- clients/js/v[0-9]+.[0-9]+.[0-9]+*
- contracts/v[0-9]+.[0-9]+.[0-9]+*
- integrations/ethers-v6/v[0-9]+.[0-9]+.[0-9]+*
- integrations/hardhat/v[0-9]+.[0-9]+.[0-9]+*
- integrations/viem-v2/v[0-9]+.[0-9]+.[0-9]+*
- integrations/wagmi-v2/v[0-9]+.[0-9]+.[0-9]+*
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: true
- name: Build JS client
working-directory: clients/js
run: pnpm build
- name: Build ethers-v6 integration
working-directory: integrations/ethers-v6
run: pnpm build
- name: Build hardhat integration
working-directory: integrations/hardhat
run: pnpm build
- name: Build Viem integration
working-directory: integrations/viem-v2
run: pnpm build
- name: Build Wagmi integration
working-directory: integrations/wagmi-v2
run: pnpm build
- name: Extract package from tag
id: extract-tag
env:
# There's no support for escaping this for use in a shell command.
# GitHub's recommendation is to pass it through the environment.
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
REF_NAME: ${{ github.ref_name }}
run: |
echo "NPM_PACKAGE=$(echo $REF_NAME | grep -oE '(clients/js|contracts|integrations/(ethers-v6|hardhat|wagmi-v2|viem-v2))')" >> $GITHUB_OUTPUT
echo "NPM_TAG=$(echo $REF_NAME | grep -oP '(?<=\-)(rc|next|alpha|beta)' || echo 'latest')" >> $GITHUB_OUTPUT
- name: Publish ${{ github.ref_name }} to NPM
run: pnpm publish --access public --no-git-checks --tag $NPM_TAG
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
NPM_TAG: ${{ steps.extract-tag.outputs.NPM_TAG }}
working-directory: ${{ steps.extract-tag.outputs.NPM_PACKAGE }}