1#!/bin/sh
2set -e
3FILES="
4 asn1.js oids.js defs.js base64.js hex.js int10.js dom.js rfcdef.js test.js tags.js
5 context.js index.css index-dark.css index.js index.html index-local.html
6 favicon.svg tree-icon-light.svg tree-icon-dark.svg
7 README.md LICENSE
8 updateOID.sh check.sh
9 examples/*
10"
11mtn automate tags 'it.lapo.asn1js{,.*}' | \
12 awk '/^revision/ { print substr($2, 2, length($2) - 2)}' | \
13 while read rev; do
14 mtn automate certs $rev | awk -v q='"' '
15 $2 == q "date" q { rdate=NR+1 }
16 $2 == q "tag" q { rtag=NR+1 }
17 NR == rdate { date=substr($2, 2, 10) }
18 NR == rtag { tag=substr($2, 2, length($2)-2) }
19 END { print date " " tag }
20 '
21 done | sort -r | awk -v q='"' '
22 BEGIN {
23 print "export const tags = {"
24 }
25 { print " " q $2 q ": " q $1 q "," }
26 END { print "};" }
27 ' > tags.js
28chmod 644 examples/*
29type gsha256sum >/dev/null 2>/dev/null && SHA256=gsha256sum || SHA256=sha256sum
30pnpm build
31cp dist/index.html index-local.html
32$SHA256 -t $FILES | gpg --clearsign > sha256sums.asc
337z a -tzip -mx=9 asn1js.zip $FILES sha256sums.asc
34rsync -Pvrtz asn1js.zip $FILES lapo.it:www/asn1js/