diff --git a/action.yml b/action.yml index 6662212..56f091b 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,20 @@ runs: env: YARN_NPM_AUTH_TOKEN: ${{ inputs.npm-token }} PUBLISH_NPM_TAG: ${{ inputs.npm-tag }} + - id: install-pkdiff + shell: bash + run: npm i -g pkdiff + - id: generate-report + shell: bash + if: inputs.npm-token == '' + run: ${{ github.action_path }}/scripts/report.sh + - id: upload-artifact + if: inputs.npm-token == '' + uses: actions/upload-artifact@v4 + with: + path: | + /tmp/*.tgz + /tmp/*.html - id: name-version shell: bash if: inputs.slack-webhook-url != '' diff --git a/scripts/publish.sh b/scripts/publish.sh index 77b8c29..31aa957 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -5,8 +5,8 @@ set -e set -o pipefail if [[ -z $YARN_NPM_AUTH_TOKEN ]]; then - echo "Notice: 'npm-token' not set. Running 'yarn pack --dry-run'." - yarn pack --dry-run + echo "Notice: 'npm-token' not set. Running 'yarn pack'." + yarn pack --out /tmp/%s-%v.tgz exit 0 fi diff --git a/scripts/report.sh b/scripts/report.sh new file mode 100755 index 0000000..be2e144 --- /dev/null +++ b/scripts/report.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -x +set -e +set -o pipefail + +directory="/tmp" + +for file in "$directory"/*.tgz; do + if [ -f "$file" ]; then + echo "Processing $file" + basename=$(basename "$file") + name="${basename%-*}" + name_with_slash="${name/-//}" + echo "$name_with_slash" + pkdiff "$name_with_slash@latest" "$file" \ + --no-exit-code \ + --no-open \ + --output "$directory/$basename.html" + fi +done