File tree Expand file tree Collapse file tree 6 files changed +531
-1042
lines changed Expand file tree Collapse file tree 6 files changed +531
-1042
lines changed Original file line number Diff line number Diff line change
1
+ name : publish-package-to-npm
2
+ on :
3
+ workflow_dispatch :
4
+ inputs :
5
+ package :
6
+ description : Package to be published
7
+ type : string
8
+ required : true
9
+ version :
10
+ description : Version to be published
11
+ type : string
12
+ required : true
13
+ dryrun :
14
+ description : Add --dry-run to npm publish step? (Uncheck to actually publish)
15
+ type : boolean
16
+ required : false
17
+ default : true
18
+
19
+ jobs :
20
+ verify-and-publish :
21
+ runs-on : ubuntu-latest
22
+ defaults :
23
+ run :
24
+ working-directory : ./packages/${{inputs.package}}
25
+ steps :
26
+ - uses : actions/checkout@v4
27
+ - uses : actions/setup-node@v4
28
+ with :
29
+ node-version : 20
30
+ - name : Verify we are using the correct package.json file
31
+ run : |
32
+ [[ -f package.json ]] || (echo "::error:: ./packages/${{inputs.package}}/package.json does not exist." && exit 1)
33
+ PACKAGE_VERSION=`cat package.json | jq '.version' | xargs`
34
+ [[ ${{ inputs.version }} == ${PACKAGE_VERSION} ]] || (echo "::error:: Input version ${{ inputs.version }} does not match package.json version ${PACKAGE_VERSION}" && exit 1)
35
+ PACKAGE_NAME=`cat package.json | jq '.name' | xargs`
36
+ [[ "@salesforce/${{ inputs.package }}" == ${PACKAGE_NAME} ]] || (echo "::error:: Input package "@salesforce/${{ inputs.package }}" does not match package.json name ${PACKAGE_NAME}" && exit 1)
37
+ - name : Build and test
38
+ run : |
39
+ npm install
40
+ npm run build
41
+ npm run test
42
+ - name : publish-to-npm
43
+ run : |
44
+ echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
45
+ if [ "${{inputs.dryrun}}" == "true" ]; then
46
+ npm publish --tag latest-alpha --access public --verbose --dry-run
47
+ else
48
+ npm publish --tag latest-alpha --access public --verbose
49
+ fi
You can’t perform that action at this time.
0 commit comments