Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a94d7072f | ||
|
|
989643cead |
@@ -76,8 +76,12 @@ jobs:
|
|||||||
# Attach zips and the signed xpi (if present) as release assets
|
# Attach zips and the signed xpi (if present) as release assets
|
||||||
for f in dist/*.zip dist/*.xpi; do
|
for f in dist/*.zip dist/*.xpi; do
|
||||||
[ -f "$f" ] || continue
|
[ -f "$f" ] || continue
|
||||||
|
NAME="$(basename "$f")"
|
||||||
|
# URL-encode the asset name so '+' (in 'ismis-helper-1.4.0-an+fx.xpi')
|
||||||
|
# survives the query string instead of being decoded to a space.
|
||||||
|
ENC=$(python3 -c "import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1], safe=''))" "$NAME")
|
||||||
curl -sS -X POST \
|
curl -sS -X POST \
|
||||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
-F "attachment=@${f}" \
|
-F "attachment=@${f}" \
|
||||||
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$(basename "${f}")"
|
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${ENC}"
|
||||||
done
|
done
|
||||||
+22
-9
@@ -20,18 +20,31 @@ const CHROME_BG_PARTS = [
|
|||||||
'background.js',
|
'background.js',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Directories never copied into a build target.
|
||||||
|
const EXCLUDED_DIRS = new Set([
|
||||||
|
'.git', 'node_modules', 'dist', 'docs', 'scripts', 'test', 'web-ext-artifacts',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Repo-root files that are for contributors, not for the shipped extension.
|
||||||
|
// manifest.json is here because it is generated per target, not copied.
|
||||||
|
const DEV_ONLY_FILES = new Set([
|
||||||
|
'manifest.json', 'AGENTS.md', 'README.md', 'package.json', 'package-lock.json',
|
||||||
|
]);
|
||||||
|
|
||||||
// Everything to copy from ROOT into a target, relative paths.
|
// Everything to copy from ROOT into a target, relative paths.
|
||||||
function collectFiles(srcDir, out = [], prefix = '') {
|
// `excludeDev` is true when reading ROOT (skip contributor files) and false when
|
||||||
|
// reading a built target (its generated manifest.json MUST be packaged).
|
||||||
|
function collectFiles(srcDir, { dir = '', excludeDev = false, out = [] } = {}) {
|
||||||
for (const entry of fs.readdirSync(srcDir)) {
|
for (const entry of fs.readdirSync(srcDir)) {
|
||||||
const abs = path.join(srcDir, entry);
|
const abs = path.join(srcDir, entry);
|
||||||
const rel = prefix ? prefix + '/' + entry : entry;
|
const rel = dir ? dir + '/' + entry : entry;
|
||||||
if (entry === '.git' || entry === 'node_modules' || entry === 'dist' ||
|
if (entry.startsWith('.') || EXCLUDED_DIRS.has(entry)) continue;
|
||||||
entry === 'docs' || entry === 'scripts' || entry === 'test' ||
|
if (excludeDev && DEV_ONLY_FILES.has(entry)) continue;
|
||||||
entry === 'manifest.json' || entry.startsWith('.')) {
|
if (fs.statSync(abs).isDirectory()) {
|
||||||
continue;
|
collectFiles(abs, { dir: rel, excludeDev, out });
|
||||||
|
} else {
|
||||||
|
out.push(rel);
|
||||||
}
|
}
|
||||||
if (fs.statSync(abs).isDirectory()) collectFiles(abs, out, rel);
|
|
||||||
else out.push(rel);
|
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -122,7 +135,7 @@ function buildTarget(target, version) {
|
|||||||
fs.rmSync(dir, { recursive: true, force: true });
|
fs.rmSync(dir, { recursive: true, force: true });
|
||||||
fs.mkdirSync(dir, { recursive: true });
|
fs.mkdirSync(dir, { recursive: true });
|
||||||
|
|
||||||
const relList = collectFiles(ROOT);
|
const relList = collectFiles(ROOT, { excludeDev: true });
|
||||||
copyDir(relList, dir);
|
copyDir(relList, dir);
|
||||||
|
|
||||||
if (target === 'firefox') {
|
if (target === 'firefox') {
|
||||||
|
|||||||
Reference in New Issue
Block a user