declapract-typescript-ehmpathy 0.46.12 → 0.46.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,4 +58,35 @@ jobs:
|
|
|
58
58
|
run: npm run build
|
|
59
59
|
|
|
60
60
|
- name: publish
|
|
61
|
+
id: publish
|
|
62
|
+
continue-on-error: true
|
|
61
63
|
run: npm publish --access public --provenance
|
|
64
|
+
|
|
65
|
+
# if publish fails, check whether the intent was successful still, for behavioral idempotency (i.e., if the failure just reported that this is a retry, then its an idempotent success)
|
|
66
|
+
- name: idempotify
|
|
67
|
+
if: steps.publish.outcome == 'failure'
|
|
68
|
+
run: |
|
|
69
|
+
# get package info
|
|
70
|
+
PACKAGE_NAME=$(jq -r '.name' package.json)
|
|
71
|
+
PACKAGE_VERSION=$(jq -r '.version' package.json)
|
|
72
|
+
|
|
73
|
+
# check if version exists on npm
|
|
74
|
+
if ! npm view "$PACKAGE_NAME@$PACKAGE_VERSION" dist.shasum > /dev/null 2>&1; then
|
|
75
|
+
echo "::error::publish: this version failed to be published. see prior step for cause"
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# get shasums: local (via dry-run) and published (via registry)
|
|
80
|
+
EXPECTED_SHASUM=$(npm pack --dry-run --json 2>/dev/null | jq -r '.[0].shasum')
|
|
81
|
+
DETECTED_SHASUM=$(npm view "$PACKAGE_NAME@$PACKAGE_VERSION" dist.shasum)
|
|
82
|
+
echo "EXPECTED_SHASUM=$EXPECTED_SHASUM"
|
|
83
|
+
echo "DETECTED_SHASUM=$DETECTED_SHASUM"
|
|
84
|
+
|
|
85
|
+
# compare shasums
|
|
86
|
+
if [ "$EXPECTED_SHASUM" = "$DETECTED_SHASUM" ]; then
|
|
87
|
+
echo "publish: idempotent success. detected version matches expected version. this was a succesful retry"
|
|
88
|
+
exit 0
|
|
89
|
+
else
|
|
90
|
+
echo "::error::publish: this version was already published with a different payload. overwrites are forbidden. EXPECTED_SHASUM=$EXPECTED_SHASUM, DETECTED_SHASUM=$DETECTED_SHASUM"
|
|
91
|
+
exit 1
|
|
92
|
+
fi
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "declapract-typescript-ehmpathy",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "declapract best practices declarations for typescript",
|
|
5
|
-
"version": "0.46.
|
|
5
|
+
"version": "0.46.13",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|