Skip to content

Commit 110e896

Browse files
committed
ci(publish-npm): add a 'dry-run' version of the promote step
This induce repeating code but will at least ensure that something is written to the console in all cases.
1 parent 008bdcd commit 110e896

File tree

1 file changed

+9
-4
lines changed
  • .github/workflows/actions/publish-npm-package

1 file changed

+9
-4
lines changed

.github/workflows/actions/publish-npm-package/action.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,18 @@ runs:
125125
npm publish --tag ${{ inputs.tag }} --access ${{ inputs.access }} $dry_run_option
126126
127127
- name: Promote package distribution tag to 'latest'
128-
if: inputs.dry_run == 'false' && steps.check_version.outputs.deploy_mode == 'promote'
128+
if: steps.check_version.outputs.deploy_mode == 'promote'
129129
shell: bash
130130
working-directory: ${{ inputs.package_dir }}
131131
env:
132132
NODE_AUTH_TOKEN: ${{ inputs.api_token }}
133133
run: |
134134
echo "Promote '${{ steps.prepare.outputs.package_name }}' package version '${{ steps.prepare.outputs.package_local_version }}' from 'next' to 'latest'"
135-
npm whoami
136-
npm dist-tag add ${{ steps.prepare.outputs.package_name }}"@${{ steps.prepare.outputs.package_local_version }} latest
137-
npm dist-tag rm ${{ steps.prepare.outputs.package_name }}"@${{ steps.prepare.outputs.package_local_version }} next
135+
if [ "${{ inputs.dry_run }}" == "false" ]; then
136+
npm whoami
137+
npm dist-tag add ${{ steps.prepare.outputs.package_name }}"@${{ steps.prepare.outputs.package_local_version }} latest
138+
npm dist-tag rm ${{ steps.prepare.outputs.package_name }}"@${{ steps.prepare.outputs.package_local_version }} next
139+
else
140+
echo "Dry run: npm dist-tag add ${{ steps.prepare.outputs.package_name }}"@${{ steps.prepare.outputs.package_local_version }} latest
141+
echo "Dry run: npm dist-tag rm ${{ steps.prepare.outputs.package_name }}"@${{ steps.prepare.outputs.package_local_version }} next
142+
fi

0 commit comments

Comments
 (0)