@@ -12,6 +12,17 @@ name: Publish Package to npmjs
12
12
on :
13
13
release :
14
14
types : [created]
15
+ env :
16
+ NODE_VERSION : " 20.x"
17
+ EVM_ARTIFACTS_PATHS : |
18
+ artifacts
19
+ cache
20
+ typechain
21
+ SVM_ARTIFACTS_PATHS : |
22
+ target/idl
23
+ target/types
24
+ src/svm/assets
25
+ src/svm/clients
15
26
jobs :
16
27
build :
17
28
runs-on : ubuntu-latest
@@ -22,26 +33,66 @@ jobs:
22
33
- name : Validate and extract release information
23
34
id : release
24
35
25
- # Setup Anchor to enable compilation and export of Solana programs
26
- - name : Extract Solana versions
27
- uses :
solana-developers/github-actions/[email protected]
28
- id : versions
29
- - name : Setup Anchor & Solana
30
- uses :
solana-developers/github-actions/[email protected]
31
- with :
32
- anchor_version : ${{ steps.versions.outputs.anchor_version }}
33
- solana_version : ${{ steps.versions.outputs.solana_version }}
34
- node_version : 20
35
- # - run: anchor build
36
+
36
37
# Setup .npmrc file to publish to npm
37
38
- uses : actions/setup-node@v3
38
39
with :
39
- node-version : " 20.x "
40
+ node-version : " ${{ env.NODE_VERSION }} "
40
41
always-auth : true
41
42
registry-url : " https://registry.npmjs.org"
43
+ cache : " yarn"
44
+
45
+ - name : Install packages
46
+ run : yarn install --frozen-lockfile
47
+
48
+ - name : Cache EVM artifacts
49
+ id : evm-artifacts-cache
50
+ uses : ./.github/actions/cache-evm-artifacts
51
+ with :
52
+ path : ${{ env.EVM_ARTIFACTS_PATHS }}
53
+ node_version : ${{ env.NODE_VERSION }}
54
+
55
+ - name : Generate EVM artifacts
56
+ if : steps.evm-artifacts-cache.outputs.cache-hit != 'true'
57
+ uses : ./.github/actions/generate-evm-artifacts
58
+ with :
59
+ node_version : ${{ env.NODE_VERSION }}
60
+
61
+ - name : Cache SVM artifacts
62
+ id : svm-artifacts-cache
63
+ uses : ./.github/actions/cache-svm-artifacts
64
+ with :
65
+ path : ${{ env.SVM_ARTIFACTS_PATHS }}
66
+ node_version : ${{ env.NODE_VERSION }}
67
+
68
+ - name : Generate SVM artifacts
69
+ if : steps.svm-artifacts-cache.outputs.cache-hit != 'true'
70
+ uses : ./.github/actions/generate-svm-artifacts
71
+ with :
72
+ node_version : ${{ env.NODE_VERSION }}
73
+
74
+ # This would duplicate installation if the SVM artifacts cache was not hit above, but otherwise the composite
75
+ # action would become more complex and we need to add solana-verify anyway.
76
+ - name : Setup Anchor & Solana
77
+ uses : ./.github/actions/setup-solana-anchor
78
+ with :
79
+ verify_version : 0.4.3
80
+ node_version : ${{ env.NODE_VERSION }}
81
+
82
+ - name : Cache verified production build binaries
83
+ id : verified-production-build-cache
84
+ uses : ./.github/actions/cache-svm-artifacts
85
+ with :
86
+ type : verified-production-binaries
87
+ path : target/deploy
88
+ node_version : ${{ env.NODE_VERSION }}
89
+
90
+ - name : Create verified build
91
+ if : steps.verified-production-build-cache.outputs.cache-hit != 'true'
92
+ run : yarn build-svm-solana-verify
42
93
43
- # Perform installs and run a build step.
44
- - run : yarn install --frozen-lockfile && yarn build
94
+ - name : Build dist package
95
+ run : yarn build-ts
45
96
46
97
# The last two steps will publish the package. Note that we're using
47
98
# information from the `release` step above (I told you we'd use it
0 commit comments