-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 2.62 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (66 loc) · 2.62 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 extension zip
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: read
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Verify version matches tag
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION="${GITHUB_REF_NAME#v}"
VERSION="$VERSION" node - <<'NODE'
const fs = require('fs');
const version = process.env.VERSION;
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')).version;
const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf8')).version;
if (pkg !== version || manifest !== version) {
console.error(`Version mismatch: tag=${version} package=${pkg} manifest=${manifest}`);
process.exit(1);
}
NODE
- name: Verify
run: |
npm test
npm run lint
npm run check:html
npm audit --audit-level=high
- name: Package Chrome extension
run: |
VERSION=$(node -p "require('./manifest.json').version")
ZIP="dist/repolens-v${VERSION}.zip"
rm -rf dist repolens-release
mkdir -p dist repolens-release
cp manifest.json README.md CHANGELOG.md repolens-release/
cp batch.html library.html options.html output-tab.html share.html stack-tab.html whats-new.html repolens-release/
cp ./*.css repolens-release/
cp -R src icons assets vendor repolens-release/
(cd repolens-release && zip -r "../${ZIP}" . -x '*.DS_Store')
unzip -Z1 "$ZIP" | sort > /tmp/repolens-zip-files.txt
cat /tmp/repolens-zip-files.txt
forbidden='(^|/)(node_modules|tests|coverage|website|mcp|docs|tools|\.github|\.git|\.verify|\.playwright-mcp)/|(^|/)(eslint\.config\.js|vitest\.config\.js|package-lock\.json|package\.json)$'
if grep -E "$forbidden" /tmp/repolens-zip-files.txt; then
echo "Release zip contains forbidden dev/test files" >&2
exit 1
fi
for required in manifest.json src/background.js output-tab.html library.html whats-new.html src/store/idb.js icons/icon128.png; do
if ! grep -Fxq "$required" /tmp/repolens-zip-files.txt; then
echo "Release zip missing required file: $required" >&2
exit 1
fi
done
- uses: actions/upload-artifact@v4
with:
name: repolens-extension-zip
path: dist/*.zip