@@ -12,6 +12,17 @@ name: Publish Package to npmjs
1212on :
1313 release :
1414 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
1526jobs :
1627 build :
1728 runs-on : ubuntu-latest
@@ -22,26 +33,48 @@ jobs:
2233 - name : Validate and extract release information
2334 id : release
243525- # 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+
3637 # Setup .npmrc file to publish to npm
3738 - uses : actions/setup-node@v3
3839 with :
39- node-version : " 20.x "
40+ node-version : " ${{ env.NODE_VERSION }} "
4041 always-auth : true
4142 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+ node_version : ${{ env.NODE_VERSION }}
53+
54+ - name : Generate EVM artifacts
55+ if : steps.evm-artifacts-cache.outputs.cache-hit != 'true'
56+ uses : ./.github/actions/generate-evm-artifacts
57+ with :
58+ path : ${{ env.EVM_ARTIFACTS_PATHS }}
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+ type : artifacts
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+ type : artifacts
73+ path : ${{ env.SVM_ARTIFACTS_PATHS }}
74+ node_version : ${{ env.NODE_VERSION }}
4275
43- # Perform installs and run a build step.
44- - run : yarn install --frozen-lockfile && yarn build
76+ - name : Build dist package
77+ run : yarn build-ts
4578
4679 # The last two steps will publish the package. Note that we're using
4780 # information from the `release` step above (I told you we'd use it
@@ -72,3 +105,54 @@ jobs:
72105 run : yarn publish --tag ${{ steps.release.outputs.tag }}
73106 env :
74107 NPM_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
108+
109+ # Due to GitHub cache scoping, we cannot easily share the cache between releases even if the cache key is the same.
110+ # In order to not slow down the NPM package publishing, we move the building of SVM binaries for GitHub release to a
111+ # separate jobs that runs in parallel.
112+ release-svm-production :
113+ name : Release SVM production binaries on GitHub
114+ runs-on : ubuntu-latest
115+ steps :
116+ - uses : actions/checkout@v2
117+
118+ - name : Setup Anchor & Solana
119+ uses : ./.github/actions/setup-solana-anchor
120+ with :
121+ verify_version : 0.4.3
122+ node_version : ${{ env.NODE_VERSION }}
123+
124+ - name : Create verified production build
125+ run : yarn build-svm-solana-verify
126+
127+ - name : Archive verified production build
128+ run : tar -czf svm-verified-production-binaries.tar.gz target/deploy
129+
130+ - name : Release verified production binaries
131+ uses : softprops/action-gh-release@v2
132+ with :
133+ files : svm-verified-production-binaries.tar.gz
134+
135+ release-svm-test :
136+ name : Release SVM test binaries on GitHub
137+ runs-on : ubuntu-latest
138+ steps :
139+ - uses : actions/checkout@v2
140+
141+ - name : Setup Anchor & Solana
142+ uses : ./.github/actions/setup-solana-anchor
143+ with :
144+ verify_version : 0.4.3
145+ node_version : ${{ env.NODE_VERSION }}
146+
147+ - name : Create verified test build
148+ env :
149+ IS_TEST : true
150+ run : yarn build-svm-solana-verify
151+
152+ - name : Archive verified test build
153+ run : tar -czf svm-verified-test-binaries.tar.gz target/deploy
154+
155+ - name : Release verified test binaries
156+ uses : softprops/action-gh-release@v2
157+ with :
158+ files : svm-verified-test-binaries.tar.gz
0 commit comments