-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7db1d8
commit 8a51b2e
Showing
3 changed files
with
23 additions
and
9 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 |
---|---|---|
|
@@ -15,17 +15,24 @@ on: | |
required: true | ||
type: string | ||
description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version' | ||
secrets: | ||
PUBLISH_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
name: Check Publish | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ fromJSON(inputs.releases)[0].tagName }} | ||
- name: Setup Git User | ||
run: | | ||
git config --global user.email "[email protected]" | ||
|
@@ -42,19 +49,21 @@ jobs: | |
node: ${{ steps.node.outputs.node-version }} | ||
- name: Install Dependencies | ||
run: npm i --ignore-scripts --no-audit --no-fund | ||
- name: Check If Published | ||
- name: Set npm authToken | ||
run: npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN} | ||
- name: Publish | ||
env: | ||
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | ||
RELEASES: ${{ inputs.releases }} | ||
run: | | ||
EXIT_CODE=0 | ||
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do | ||
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)" | ||
npm view "$SPEC" --json | ||
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag) | ||
npm publish --provenance --tag="$PUBLISH_TAG" | ||
STATUS=$? | ||
if [[ "$STATUS" -eq 1 ]]; then | ||
EXIT_CODE=$STATUS | ||
echo "$SPEC ERROR" | ||
else | ||
echo "$SPEC OK" | ||
fi | ||
done | ||
|
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
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