-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (62 loc) · 2.31 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (62 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Release
on:
push:
tags: ['v*']
# Lets you produce a package off an untagged commit without cutting a
# release — useful for handing someone a build to load unpacked.
workflow_dispatch:
permissions:
contents: write
jobs:
package:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
# manifest.json is the source of truth for the shipped version — the Web
# Store rejects a re-used version, and package.json can't hold Chrome's
# non-semver scheme (0.20) anyway.
- name: Resolve version
id: version
run: echo "value=$(node -p "require('./manifest.json').version")" >> "$GITHUB_OUTPUT"
- name: Verify tag matches manifest version
if: startsWith(github.ref, 'refs/tags/')
env:
MANIFEST: ${{ steps.version.outputs.value }}
run: |
tag="${GITHUB_REF_NAME#v}"
if [ "$tag" != "$MANIFEST" ]; then
echo "::error::tag $GITHUB_REF_NAME implies version $tag but manifest.json says $MANIFEST"
exit 1
fi
# Guards a real regression: an earlier package shipped internal URLs and
# scenario mock data. See store/UPLOAD-GUIDE.md.
- name: Verify no codeyam artifacts or internal URLs in build
run: |
if grep -rlE "codeyam|s2/favicons|notion\.so|fonts\.googleapis" build; then
echo "::error::build/ contains codeyam artifacts or internal URLs"
exit 1
fi
# manifest.json must sit at the ZIP ROOT. -X drops extra file attributes
# so the archive is reproducible.
- name: Package
run: |
mkdir -p dist
cd build && zip -rqX "../dist/tabcommand-${{ steps.version.outputs.value }}.zip" . -x ".*"
- uses: actions/upload-artifact@v7
with:
name: tabcommand-${{ steps.version.outputs.value }}
path: dist/*.zip
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" dist/*.zip --title "$GITHUB_REF_NAME" --generate-notes