-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·74 lines (59 loc) · 2.34 KB
/
publish.sh
File metadata and controls
executable file
·74 lines (59 loc) · 2.34 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
72
73
74
#!/bin/bash
# build the OID4VP spec and copy it into publication repo
#
# assumes you've done:
# git checkout git@github.com:openid/publication.git
# at the same level as OpenID4VP repo is checked out at, and that the publication repo
# is up to date / has no other changes / etc
#
# after running this script, run commands in that repo like:
# git checkout -b propose/oid4vp-30
# git add digital-credentials-protocols/openid*
# git commit -a -m 'Add OID4VP draft 30'
# git push -u origin HEAD
# then open a PR
#
# please also add a tag on the OpenID4VP repo,e.g. : git tag draft-30 && git push --tags
set -e
SPEC=openid-4-verifiable-presentations-1_0.md
# exit if uncommitted changes
# commands suggested by https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommitted-changes
git update-index --refresh || (echo "Aborted: Uncommitted changes found" && exit 1)
git diff-index --quiet HEAD -- || (echo "Aborted: Uncommitted changes found" && exit 1)
# get current draft number from this line in spec:
# value = "openid-4-verifiable-credential-issuance-1_0-14"
VERSION=`perl -ne 'print $1 and last if /^value = ".*-([0-9]+)"/' $SPEC`
if [ -z "$VERSION" ]; then
echo "Unable to find spec version"
exit 1
fi
echo "Spec version is '$VERSION'"
# change:
# title = "OpenID for Verifiable Credential Issuance - Editor's draft"
# to
# title = "OpenID for Verifiable Credential Issuance - draft 14"
perl -pi -e "s/^(title = \".* -) Editor.s draft\"/\$1 draft $VERSION\"/" $SPEC
# build spec
BASENAME=`basename $SPEC .md`
SPECHTML=${BASENAME}-${VERSION}.html
SPECXML=${BASENAME}-${VERSION}.xml
SPECZIP=${BASENAME}-${VERSION}.zip
SPECWITHVERSION=${BASENAME}-${VERSION}.md
rm -f $SPECHTML $SPECXML $SPECZIP $SPECHTMLWITHOUTVERSION $SPECXMLWITHOUTVERSION $SPECZIPWITHOUTVERSION
docker run -v `pwd`:/data danielfett/markdown2rfc $SPEC
if [ ! -e $SPECHTML ]; then
echo "$SPECHTML not found after building spec"
exit 1
fi
if [ ! -e $SPECXML ]; then
echo "$SPECXML not found after building spec"
exit 1
fi
# create numbered version of spec
cp $SPEC $SPECWITHVERSION
# zip source code
rm -f $SPECZIP
zip -r $SPECZIP $SPEC $SPECHTML $SPECXML examples/
echo "Created $SPECZIP"
cp $SPECWITHVERSION $SPECHTML $SPECZIP ../publication/digital-credentials-protocols/
echo "Finished. Now commit the files in the publication repo & open a PR there."