-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW: @W-15652656@: Add in manual workflow to publish to npm (#11)
- Loading branch information
1 parent
af2dc05
commit 4753eba
Showing
6 changed files
with
531 additions
and
1,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: publish-package-to-npm | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package: | ||
description: Package to be published | ||
type: string | ||
required: true | ||
version: | ||
description: Version to be published | ||
type: string | ||
required: true | ||
dryrun: | ||
description: Add --dry-run to npm publish step? (Uncheck to actually publish) | ||
type: boolean | ||
required: false | ||
default: true | ||
|
||
jobs: | ||
verify-and-publish: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./packages/${{inputs.package}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Verify we are using the correct package.json file | ||
run: | | ||
[[ -f package.json ]] || (echo "::error:: ./packages/${{inputs.package}}/package.json does not exist." && exit 1) | ||
PACKAGE_VERSION=`cat package.json | jq '.version' | xargs` | ||
[[ ${{ inputs.version }} == ${PACKAGE_VERSION} ]] || (echo "::error:: Input version ${{ inputs.version }} does not match package.json version ${PACKAGE_VERSION}" && exit 1) | ||
PACKAGE_NAME=`cat package.json | jq '.name' | xargs` | ||
[[ "@salesforce/${{ inputs.package }}" == ${PACKAGE_NAME} ]] || (echo "::error:: Input package "@salesforce/${{ inputs.package }}" does not match package.json name ${PACKAGE_NAME}" && exit 1) | ||
- name: Build and test | ||
run: | | ||
npm install | ||
npm run build | ||
npm run test | ||
- name: publish-to-npm | ||
run: | | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | ||
if [ "${{inputs.dryrun}}" == "true" ]; then | ||
npm publish --tag latest-alpha --access public --verbose --dry-run | ||
else | ||
npm publish --tag latest-alpha --access public --verbose | ||
fi |
Oops, something went wrong.