Skip to content

Commit

Permalink
build: modfying publish action to use npm cli to include provenance i…
Browse files Browse the repository at this point in the history
…n npm publish
  • Loading branch information
rsoberano-ld committed Nov 22, 2023
1 parent a3ec167 commit 7396b94
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ jobs:
uses: ./actions/publish
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
workspace_path: ${{ inputs.workspace_path }}
prerelease: ${{ inputs.prerelease }}
dry_run: ${{ inputs.dry_run }}
1 change: 1 addition & 0 deletions actions/full-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ runs:
- uses: ./actions/publish
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
workspace_path: ${{ inputs.workspace_path }}
prerelease: false
dry_run: false
- uses: ./actions/publish-docs
Expand Down
4 changes: 4 additions & 0 deletions actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
workspace_name:
description: 'The workspace to publish'
required: true
workspace_path:
description: 'Path to the workspace (for npm publish)'
required: true
prerelease:
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
required: true
Expand All @@ -21,5 +24,6 @@ runs:
./scripts/publish.sh
env:
WORKSPACE: ${{ inputs.workspace_name }}
WORKSPACE_PATH: ${{ inputs.workspace_path }}
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }}
LD_RELEASE_IS_DRYRUN: ${{ inputs.dry_run }}
6 changes: 3 additions & 3 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
yarn workspace $WORKSPACE pack
if $LD_RELEASE_IS_DRYRUN ; then
# Dry run just pack the workspace.
echo "Doing a dry run of publishing."
yarn workspace $WORKSPACE pack
else
if $LD_RELEASE_IS_PRERELEASE ; then
echo "Publishing with prerelease tag."
yarn workspace $WORKSPACE npm publish --tag prerelease || { echo "npm publish failed" >&2; exit 1; }
npm publish --tag prerelease --provenance --access public "./$WORKSPACE_PATH/package.tgz" || { echo "npm publish failed" >&2; exit 1; }
else
yarn workspace $WORKSPACE npm publish || { echo "npm publish failed" >&2; exit 1; }
npm publish --provenance --access public "./$WORKSPACE_PATH/package.tgz" || { echo "npm publish failed" >&2; exit 1; }
fi
fi

0 comments on commit 7396b94

Please sign in to comment.