Skip to content

Commit 97483f1

Browse files
tkirda-bisonclaude
andcommitted
ci: add tag-triggered npm release workflow with provenance
Adds .github/workflows/release.yml that fires on git tag v*. Steps: verify the tag matches package.json version, run the full ci sweep (lint, format:check, typecheck, test, build), npm publish with --provenance via Trusted Publisher (OIDC, no NPM_TOKEN), then gh release create with auto-generated notes. Also: - package.json files: add license.txt so the canonical license ships in the tarball (was missing after dist/license.txt was removed in the 2.0.0 rewrite). - index.htm: point script tag at dist/ since src/jquery.autocomplete.js no longer exists. One-time setup the maintainer must do on npmjs.com before the first tag: configure a Trusted Publisher pointing at this repo + release.yml + "npm-publish" environment. See the comment at the top of the workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e1e8a44 commit 97483f1

4 files changed

Lines changed: 76 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
# Fires when a tag like v2.0.0 is pushed. Validates the tag matches
4+
# package.json, runs the full CI sweep, publishes to npm with provenance
5+
# (OIDC via Trusted Publisher — no NPM_TOKEN needed), then opens a GitHub
6+
# Release with auto-generated notes.
7+
#
8+
# One-time setup required on npmjs.com before this can fire:
9+
# npmjs.com -> Package settings -> "Trusted publisher" ->
10+
# repo: devbridge/jQuery-Autocomplete
11+
# workflow: release.yml
12+
# environment: npm-publish
13+
# See https://docs.npmjs.com/trusted-publishers
14+
15+
on:
16+
push:
17+
tags:
18+
- "v*"
19+
20+
jobs:
21+
release:
22+
runs-on: ubuntu-latest
23+
environment: npm-publish
24+
permissions:
25+
id-token: write # OIDC token for npm provenance
26+
contents: write # creating the GitHub Release
27+
steps:
28+
- uses: actions/checkout@v6
29+
30+
- uses: actions/setup-node@v6
31+
with:
32+
node-version: 20
33+
cache: npm
34+
registry-url: https://registry.npmjs.org
35+
36+
- run: npm ci
37+
38+
- name: Verify tag matches package.json version
39+
run: |
40+
tag_version="${GITHUB_REF_NAME#v}"
41+
pkg_version="$(node -p "require('./package.json').version")"
42+
if [ "$tag_version" != "$pkg_version" ]; then
43+
echo "Tag $GITHUB_REF_NAME does not match package.json version $pkg_version" >&2
44+
exit 1
45+
fi
46+
47+
- run: npm run lint
48+
- run: npm run format:check
49+
- run: npm run typecheck
50+
- run: npm test
51+
- run: npm run build
52+
53+
- run: npm publish --provenance --access public
54+
55+
- name: Create GitHub Release
56+
env:
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: gh release create "$GITHUB_REF_NAME" --generate-notes --verify-tag

index.htm

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,53 @@
11
<!DOCTYPE html>
22
<html xmlns="http://www.w3.org/1999/xhtml">
3+
34
<head>
45
<title>DevBridge Autocomplete Demo</title>
56
<link href="content/styles.css" rel="stylesheet" />
67
</head>
8+
79
<body>
810
<div class="container">
911
<h1>Ajax Autocomplete Demo</h1>
1012

1113
<h2>Ajax Lookup</h2>
1214
<p>Type country name in english:</p>
1315
<div style="position: relative; height: 80px;">
14-
<input type="text" name="country" id="autocomplete-ajax" style="position: absolute; z-index: 2; background: transparent;"/>
15-
<input type="text" name="country" id="autocomplete-ajax-x" disabled="disabled" style="color: #CCC; position: absolute; background: transparent; z-index: 1;"/>
16+
<input type="text" name="country" id="autocomplete-ajax"
17+
style="position: absolute; z-index: 2; background: transparent;" />
18+
<input type="text" name="country" id="autocomplete-ajax-x" disabled="disabled"
19+
style="color: #CCC; position: absolute; background: transparent; z-index: 1;" />
1620
</div>
1721
<div id="selction-ajax"></div>
18-
22+
1923
<h2>Local Lookup and Grouping</h2>
2024
<p>Type NHL or NBA team name:</p>
2125
<div>
22-
<input type="text" name="country" id="autocomplete"/>
26+
<input type="text" name="country" id="autocomplete" />
2327
</div>
2428
<div id="selection"></div>
2529

2630
<h2>Custom Lookup Container</h2>
2731
<p>Type country name in english:</p>
2832
<div>
29-
<input type="text" name="country" id="autocomplete-custom-append" style="float: left;"/>
33+
<input type="text" name="country" id="autocomplete-custom-append" style="float: left;" />
3034
<div id="suggestions-container" style="position: relative; float: left; width: 400px; margin: 10px;"></div>
3135
</div>
3236
</div>
33-
37+
3438
<div style="width: 50%; margin: 0 auto; clear: both;">
3539
<h2>Dynamic Width</h2>
3640
<p>Type country name in english:</p>
3741
<div>
38-
<input type="text" name="country" id="autocomplete-dynamic" style="width: 100%; border-width: 5px;"/>
42+
<input type="text" name="country" id="autocomplete-dynamic" style="width: 100%; border-width: 5px;" />
3943
</div>
4044
</div>
4145

4246
<script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
4347
<script type="text/javascript" src="https://unpkg.com/jquery-mockjax@2.6.0/dist/jquery.mockjax.js"></script>
44-
<script type="text/javascript" src="src/jquery.autocomplete.js"></script>
48+
<script type="text/javascript" src="dist/jquery.autocomplete.js"></script>
4549
<script type="text/javascript" src="scripts/countries.js"></script>
4650
<script type="text/javascript" src="scripts/demo.js"></script>
4751
</body>
52+
4853
</html>

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
},
5656
"files": [
5757
"dist/",
58-
"readme.md"
58+
"readme.md",
59+
"license.txt"
5960
]
6061
}

0 commit comments

Comments
 (0)