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