@@ -3,7 +3,7 @@ name: Publish JS
33on :
44 workflow_dispatch :
55 inputs :
6- package_path :
6+ package-path :
77 description : Path to directory with package to release
88 required : true
99 default : ' clients/js'
2929 required : true
3030 type : string
3131 default : latest
32- create_release :
32+ create-release :
3333 description : Create a GitHub release
3434 required : true
3535 type : boolean
@@ -51,117 +51,18 @@ jobs:
5151 shell : bash
5252 run : |
5353 echo "SOLANA_CLI_VERSION=$(make solana-cli-version)" >> "$GITHUB_OUTPUT"
54- TARGET=$(echo ${{ inputs.package_path }} | sed 's#/#-#')
54+ TARGET=$(echo ${{ inputs.package-path }} | sed 's#/#-#')
5555 echo "TARGET=$TARGET" >> "$GITHUB_OUTPUT"
5656
57- test :
58- name : Test package
57+ main :
5958 needs : set_env
60- runs-on : ubuntu-latest
61- steps :
62- - name : Git Checkout
63- uses : actions/checkout@v4
64-
65- - name : Setup Environment
66- uses : solana-program/actions/setup-ubuntu@main
67- with :
68- solana : ${{ needs.set_env.outputs.SOLANA_CLI_VERSION }}
69- cargo-cache-key : cargo-publish-js-test-${{ inputs.package_path }}
70- cargo-cache-fallback-key : cargo-publish-js-test
71-
72- - name : Format
73- run : make format-check-${{ needs.set_env.outputs.TARGET }}
74-
75- - name : Lint
76- run : make lint-${{ needs.set_env.outputs.TARGET }}
77-
78- - name : Build Token-2022
79- run : make build-sbf-program
80-
81- - name : Build ElGamal Registry
82- run : make build-sbf-confidential-elgamal-registry
83-
84- - name : Test
85- run : make test-${{ needs.set_env.outputs.TARGET }}
86-
87- publish :
88- name : Publish package
89- runs-on : ubuntu-latest
90- needs : test
91- permissions :
92- contents : write
93- steps :
94- - name : Git Checkout
95- uses : actions/checkout@v4
96- with :
97- token : ${{ secrets.ANZA_TEAM_PAT }}
98- fetch-depth : 0 # get the whole history for git-cliff
99-
100- - name : Setup Environment
101- uses : solana-program/actions/setup-ubuntu@main
102- with :
103- pnpm : true
104-
105- - name : Ensure SOLANA_NPM_TOKEN variable is set
106- env :
107- token : ${{ secrets.SOLANA_NPM_TOKEN }}
108- if : ${{ env.token == '' }}
109- run : |
110- echo "The SOLANA_NPM_TOKEN secret variable is not set"
111- echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
112- exit 1
113-
114- - name : Ensure SOLANA_PROGRAM_NPM_TOKEN variable is set
115- env :
116- token : ${{ secrets.SOLANA_PROGRAM_NPM_TOKEN }}
117- if : ${{ env.token == '' }}
118- run : |
119- echo "The SOLANA_PROGRAM_NPM_TOKEN secret variable is not set"
120- echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
121- exit 1
122-
123- - name : NPM Authentication
124- env :
125- SOLANA_NPM_TOKEN : ${{ secrets.SOLANA_NPM_TOKEN }}
126- SOLANA_PROGRAM_NPM_TOKEN : ${{ secrets.SOLANA_PROGRAM_NPM_TOKEN }}
127- shell : bash
128- run : |
129- cd "${{ inputs.package_path }}"
130- org="$(jq '.name|split("/")|.[0]' package.json)"
131- if [[ $org == "\"@solana-program\"" ]] then
132- pnpm config set '//registry.npmjs.org/:_authToken' "${SOLANA_PROGRAM_NPM_TOKEN}"
133- elif [[ $org == "\"@solana\"" ]] then
134- pnpm config set '//registry.npmjs.org/:_authToken' "${SOLANA_NPM_TOKEN}"
135- else
136- echo "Unknown organization: $org"
137- exit 1
138- fi
139-
140- - name : Set Git Author
141- run : |
142- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
143- git config --global user.name "github-actions[bot]"
144-
145- - name : Publish
146- id : publish
147- run : ./scripts/publish-js.sh "${{ inputs.package_path }}" ${{ inputs.level }} ${{ inputs.tag }}
148-
149- - name : Push Commit and Tag
150- run : git push origin --follow-tags
151-
152- - name : Generate a changelog
153- if : github.event.inputs.create_release == 'true'
154- uses : orhun/git-cliff-action@v4
155- with :
156- config : " scripts/cliff.toml"
157- args : ${{ steps.publish.outputs.old_git_tag }}..HEAD --include-path "${{ inputs.package_path }}/**" --github-repo ${{ github.repository }}
158- env :
159- OUTPUT : TEMP_CHANGELOG.md
160- GITHUB_REPO : ${{ github.repository }}
161-
162- - name : Create GitHub release
163- if : github.event.inputs.create_release == 'true'
164- uses : ncipollo/release-action@v1
165- with :
166- tag : ${{ steps.publish.outputs.new_git_tag }}
167- bodyFile : TEMP_CHANGELOG.md
59+ uses : solana-program/actions/.github/workflows/publish-js.yml@main
60+ with :
61+ sbpf-program-packages : " program confidential-elgamal-registry"
62+ solana-cli-version : ${{ needs.set_env.outputs.SOLANA_CLI_VERSION }}
63+ target : ${{ needs.set_env.outputs.TARGET }}
64+ package-path : ${{ inputs.package-path }}
65+ level : ${{ inputs.level }}
66+ tag : ${{ inputs.tag }}
67+ create-release : ${{ inputs.create-release }}
68+ secrets : inherit
0 commit comments