dsh-publish-helper 0.21.1 → 0.21.2
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.
- package/index.js +5 -0
- package/package.json +1 -1
- package/templates/release.yml +19 -3
package/index.js
CHANGED
|
@@ -481,6 +481,11 @@ export function apply(ctx, rawConfig) {
|
|
|
481
481
|
path,
|
|
482
482
|
content: readFileSync(join(directory, path)).toString('base64'),
|
|
483
483
|
}));
|
|
484
|
+
const workflowPath = '.github/workflows/release.yml';
|
|
485
|
+
if (!files.some((file) => file.path === workflowPath)) {
|
|
486
|
+
const template = readFileSync(new URL('./templates/release.yml', import.meta.url), 'utf8');
|
|
487
|
+
files.push({ path: workflowPath, content: Buffer.from(template, 'utf8').toString('base64') });
|
|
488
|
+
}
|
|
484
489
|
const written = await uploadFiles({ token, owner: login, name, files, message: `Upload ${name}` });
|
|
485
490
|
return {
|
|
486
491
|
text: `repo ${login}/${name}\nbranch ${created.defaultBranch}\n${written.length} file(s): ${written.join(', ')}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-publish-helper",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "DSH plugin publishing assistant: discover by topic, check listing readiness, generate the registry entry, open the pull request and show a settings page.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
package/templates/release.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copy to .github/workflows/release.yml in
|
|
1
|
+
# Copy to .github/workflows/release.yml in the package repository.
|
|
2
2
|
#
|
|
3
3
|
# Trusted publishing (recommended): configure it once on npmjs.com
|
|
4
4
|
# package page -> Settings -> Trusted publishing -> GitHub Actions
|
|
@@ -35,11 +35,27 @@ jobs:
|
|
|
35
35
|
- name: Use the npm CLI that supports trusted publishing
|
|
36
36
|
run: npm install -g npm@latest
|
|
37
37
|
|
|
38
|
+
- name: Verify the tag matches package.json
|
|
39
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
40
|
+
run: |
|
|
41
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
42
|
+
version=$(node -p "require('./package.json').version")
|
|
43
|
+
if [ "$tag" != "$version" ]; then
|
|
44
|
+
echo "tag $tag does not match package.json version $version"
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
38
48
|
- name: Install dependencies
|
|
39
|
-
run: npm
|
|
49
|
+
run: npm install --ignore-scripts --no-audit --no-fund
|
|
40
50
|
|
|
41
51
|
- name: Test
|
|
42
|
-
run:
|
|
52
|
+
run: |
|
|
53
|
+
if [ -d test ]; then
|
|
54
|
+
for file in test/*.test.mjs; do
|
|
55
|
+
[ -e "$file" ] || continue
|
|
56
|
+
node "$file"
|
|
57
|
+
done
|
|
58
|
+
fi
|
|
43
59
|
|
|
44
60
|
- name: Publish with provenance
|
|
45
61
|
run: npm publish --provenance --access public
|