-
Notifications
You must be signed in to change notification settings - Fork 20
95 lines (81 loc) · 2.41 KB
/
publish-js-client.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
name: Publish JS Client
on:
workflow_dispatch:
inputs:
level:
description: Version level
required: true
default: patch
type: choice
options:
- patch
- minor
- major
- prerelease
- prepatch
- preminor
- premajor
tag:
description: NPM Tag (and preid for pre-releases)
required: true
type: string
default: latest
create_release:
description: Create a GitHub release
required: true
type: boolean
default: true
jobs:
test_js:
name: Test JS client
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup
with:
solana: true
- name: Format JS Client
run: pnpm clients:js:format
- name: Lint JS Client
run: pnpm clients:js:lint
- name: Test JS Client
run: pnpm clients:js:test
publish_js:
name: Publish JS client
runs-on: ubuntu-latest
needs: test_js
permissions:
contents: write
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup Environment
uses: ./.github/actions/setup
- name: Ensure NPM_TOKEN variable is set
env:
token: ${{ secrets.NPM_TOKEN }}
if: ${{ env.token == '' }}
run: |
echo "The NPM_TOKEN secret variable is not set"
echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
exit 1
- name: NPM Authentication
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set Git Author
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Publish JS Client
id: publish
run: pnpm clients:js:publish ${{ inputs.level }} ${{ inputs.tag }}
- name: Push Commit and Tag
run: git push origin --follow-tags
- name: Create GitHub release
if: github.event.inputs.create_release == 'true'
uses: ncipollo/release-action@v1
with:
tag: js@v${{ steps.publish.outputs.new_version }}