@@ -46,16 +46,42 @@ jobs:
4646 TAG=${{ github.event.release.tag_name || inputs.tag }}
4747 PACKAGE_VERSION=v`cat package.json | jq '.version' | xargs`
4848 [[ ${TAG} == ${PACKAGE_VERSION} ]] || (echo "Tag name must match package.json version, prefixed by lowercase v" && exit 1)
49+ - name : Check if this version number is already used on NPM
50+ run : |
51+ RESPONSE=$(npm view .@$INPUTS_GITHUB_TAG version --json --silent || echo "Not published")
52+ if [ "$RESPONSE" = "\"$INPUTS_GITHUB_TAG\"" ]; then
53+ echo "NPM already has a package with this version number, so publishing is impossible." && exit 1
54+ else
55+ echo "NPM does not yet have a package with this version number, so we're free to use it here."
56+ fi
57+ env :
58+ INPUTS_GITHUB_TAG : ${{ github.event.release.tag_name || inputs.tag }}
59+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
4960 # Step 2: Publish the tag as a release candidate.
5061 publish-rc :
5162 needs : verify-candidate-tag
52- uses : salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
53- with :
54- ctc : false # We've been told we don't have to care about this until someone makes us care.
55- sign : true
56- tag : latest-rc # Publish as a release candidate, so we can do our validations against it.
57- githubTag : ${{ github.event.release.tag_name || inputs.tag }}
58- secrets : inherit
63+ runs-on : ubuntu-latest
64+ steps :
65+ - uses : actions/checkout@v4
66+ with :
67+ ref : ${{ github.event.release.tag_name || inputs.tag }}
68+ - uses : actions/setup-node@v4
69+ with :
70+ node-version : ' lts/*'
71+ - run : npm install && npm run build
72+ - run : npm install -g @salesforce/plugin-release-management
73+ - name : NPM release
74+ run : |
75+ sf-release npm:package:release \
76+ --githubtag "$INPUTS_GITHUB_TAG" \
77+ --npmtag "$INPUTS_NPM_TAG" \
78+ --no-install \
79+ --sign
80+ env :
81+ INPUTS_GITHUB_TAG : ${{ github.event.release.tag_name || inputs.tag }}
82+ INPUTS_NPM_TAG : latest-rc # Publish as a release candidate, so we can do our validations against it.
83+ AWS_ACCESS_KEY_ID : ${{secrets.AWS_ACCESS_KEY_ID}}
84+ AWS_SECRET_ACCESS_KEY : ${{secrets.AWS_SECRET_ACCESS_KEY}}
5985 # Step 3: Run smoke tests against the release candidate.
6086 rc-test :
6187 needs : publish-rc
0 commit comments