-
Notifications
You must be signed in to change notification settings - Fork 0
/
zip.sh
executable file
·44 lines (34 loc) · 1017 Bytes
/
zip.sh
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
#!/bin/bash
set -eux
jar_name='HeslingtonHustle.jar'
zipdir='exam'
zip_file="${1:-exam.zip}"
# create folder for submission
rm -rf "${zipdir}"
mkdir -p "${zipdir}"
# copy url file
cp url2.txt "${zipdir}"
# get executable jar
# skips download if there's no new release
# wget \
# --timestamping \
# "https://github.com/eng1team28/game2/releases/latest/download/${jar_name}"
# using gh instead allows downloading
# from a private repo
gh release download \
--repo 'eng1team28/game2' \
--pattern '*.jar' \
--clobber
# copy jar to zip directory
cp "${jar_name}" "${zipdir}"
# update submodules
git submodule foreach git pull
# copy pdfs
cp eng1team28.github.io/pdf/*.pdf "${zipdir}/"
# copy source code
# checked-in files only using git archive
impl_dir="${zipdir}/game2/"
mkdir -p "${impl_dir}"
git -C 'game2/' archive --format='tar' 'HEAD' | bsdtar --extract --directory "${impl_dir}"
# create submission zip
bsdtar --auto-compress --create --file "${zip_file}" --directory "${zipdir}" ./