Merge pull request #3632 from tridactyl/smaller_reproduction

Smaller reproduction
This commit is contained in:
Oliver Blanthorn 2021-04-30 10:33:35 +01:00 committed by GitHub
commit dd8176c4f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 19 deletions

1
.gitignore vendored
View file

@ -15,3 +15,4 @@ compiler/**/*.js
.*.generated.ts
.tmp/
.DS_Store
.build_cache/

View file

@ -4,10 +4,18 @@ set -e
err() { echo "error: line $(caller)"; }
trap err ERR
mkdir -p .build_cache
cd src/static
authors="../../build/static/authors.html"
sed "/REPLACETHIS/,$ d" authors.html > "$authors"
git shortlog -sn HEAD | cut -c8- | awk '!seen[$0]++' | sed 's/^/<p>/' | sed 's/$/<\/p>/' >> "$authors"
# If we're in a git repo, refresh the cache
if [ -d "../../.git/" ]; then
git shortlog -sn HEAD | cut -c8- | awk '!seen[$0]++' | sed 's/^/<p>/' | sed 's/$/<\/p>/' > ../../.build_cache/authors
fi
cat ../../.build_cache/authors >> "$authors"
sed "1,/REPLACETHIS/ d" authors.html >> "$authors"

View file

@ -4,7 +4,7 @@ set -e
sign_and_submit() {
# Don't trust the return value of web-ext sign.
(source AMOKEYS && (web-ext sign -s build --api-key $AMOKEY --api-secret $AMOSECRET "$@" || true))
(source AMOKEYS && (yarn run web-ext sign -s build --api-key "$AMOKEY" --api-secret "$AMOSECRET" "$@" || true))
}
publish_beta_nonewtab() {
@ -23,6 +23,7 @@ publish_beta() {
scripts/version.js beta
sed 's/"name": "Tridactyl"/"name": "Tridactyl: Beta"/' -i build/manifest.json
sign_and_submit
tar --exclude-from=<(.grep -v .build_cache/ .gitignore) --exclude-vcs -czf ../../public_html/betas/tridactyl_source_beta.tar.gz .
}
build_no_sign_beta(){
@ -31,9 +32,9 @@ build_no_sign_beta(){
scripts/version.js beta
sed 's/"name": "Tridactyl"/"name": "Tridactyl: Beta"/' -i build/manifest.json
mkdir -p web-ext-artifacts
$(yarn bin)/web-ext build --source-dir ./build --overwrite-dest
yarn run web-ext build --source-dir ./build --overwrite-dest
for f in web-ext-artifacts/*.zip; do
mv $f ${f%.zip}.xpi
mv "$f" "${f%.zip}".xpi
done
}
@ -42,9 +43,9 @@ build_no_sign_stable(){
yarn run build --no-native
sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim@cmcaine/' -i build/manifest.json
mkdir -p web-ext-artifacts
$(yarn bin)/web-ext build --source-dir ./build --overwrite-dest
yarn run web-ext build --source-dir ./build --overwrite-dest
for f in web-ext-artifacts/*.zip; do
mv $f ${f%.zip}.xpi
mv "$f" "${f%.zip}".xpi
done
}
@ -53,7 +54,7 @@ publish_stable() {
yarn run build --no-native
sed 's/tridactyl.vim.betas@cmcaine/tridactyl.vim@cmcaine/' -i build/manifest.json
sign_and_submit
tar --exclude-from=.gitignore -czf ../../public_html/betas/tridactyl_source.tar.gz .
tar --exclude-from=<(grep -v .build_cache/ .gitignore) --exclude-vcs -czf ../../public_html/betas/tridactyl_source.tar.gz .
}
case $1 in
@ -61,5 +62,6 @@ case $1 in
nosignstable) build_no_sign_stable;;
nosignbeta) build_no_sign_beta;;
nonewtab) publish_beta_nonewtab;;
*|beta) publish_beta;;
beta) publish_beta;;
*) publish_beta;;
esac

View file

@ -1,6 +1,7 @@
#!/usr/bin/env node
const { exec } = require("child_process")
const fs = require("fs")
function bump_version(versionstr, component = 2) {
const versionarr = versionstr.split(".")
@ -12,21 +13,37 @@ function bump_version(versionstr, component = 2) {
}
async function add_beta(versionstr) {
return new Promise((resolve, err) => {
exec("git rev-list --count HEAD", (execerr, stdout, stderr) => {
if (execerr) err(execerr)
resolve(versionstr + "pre" + stdout.trim())
await fs.promises.mkdir(".build_cache", {recursive: true})
try {
await fs.promises.access(".git")
await new Promise((resolve, err) => {
exec("git rev-list --count HEAD > .build_cache/count", (execerr, stdout, stderr) => {
if (execerr) err(execerr)
resolve(stdout.trim())
})
})
})
}
catch {
; // Not in a git directory - don't do anything
}
return versionstr + "pre" + (await fs.promises.readFile(".build_cache/count", {encoding: "utf8"})).trim()
}
async function get_hash() {
return new Promise((resolve, err) => {
exec("git rev-parse --short HEAD", (execerr, stdout, stderr) => {
if (execerr) err(execerr)
resolve(stdout.trim())
await fs.promises.mkdir(".build_cache", {recursive: true})
try {
await fs.promises.access(".git")
await new Promise((resolve, err) => {
exec("git rev-parse --short HEAD > .build_cache/hash", (execerr, stdout, stderr) => {
if (execerr) err(execerr)
resolve(stdout.trim())
})
})
})
}
catch {
; // Not in a git directory - don't do anything
}
return (await fs.promises.readFile(".build_cache/hash", {encoding: "utf8"})).trim()
}
function make_update_json(versionstr) {
@ -102,7 +119,7 @@ async function main() {
make_update_json(manifest.version),
)
} catch(e) {
console.warn("updates.json wasn't updated: " + e)
console.warn("Unless you're the buildbot, ignore this error: " + e)
}
// Save manifest.json