-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdo_release.sh
More file actions
executable file
·68 lines (57 loc) · 2.22 KB
/
Copy pathdo_release.sh
File metadata and controls
executable file
·68 lines (57 loc) · 2.22 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
#!/usr/bin/env bash
# This is a script for doing a SIMPLE release
# You need to have prepared python virtual environment with dependencies
# See RELEASE.md for details
#
# How to run:
# `do_release.sh <FORMAT_VERSION> <DICT_VERSION> </path/to/directory/with/raw/dictionaries> <aws_profile> <aws_mfa_uid> [<DICT_VERSION_FOR_PYTHON>]`
# e.g. `do_release.sh v0 20260723 ./raw_dict/20260723/v0/ aws_profile arn:aws:iam::0123456789012:mfa/hoge-fuga`
set -euox pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ $# -ne 5 ] && [ $# -ne 6 ]; then
>&2 echo "Usage: $0 <FORMAT_VERSION> <DICT_VERSION> <RAW_DIC_PATH> <AWS_PROFILE> <AWS_MFA_ID> [<PY_PACKAGE_VERSION>]"
>&2 echo "Example: $0 v0 20260723 ./raw_dict/20260723/v0/ aws_profile arn:aws:iam::0123456789012:mfa/hoge-fuga"
exit 1
fi
FORMAT_VERSION=$1; shift
DICT_VERSION=$1; shift
RAW_DIC_PATH=$1; shift
AWS_PROFILE=$1; shift
AWS_MFA_ID=$1; shift
if [ $# -eq 0 ]; then
PY_PACKAGE_VERSION=${DICT_VERSION}
else
PY_PACKAGE_VERSION=$1; shift
fi
# arg validation
if [ $FORMAT_VERSION != "v0" ] && [ $FORMAT_VERSION != "v1" ]; then
>&2 echo "Unsupported dictionary format version: $FORMAT_VERSION"
exit 1
fi
# upload dictionary csvs to s3
python3 "$SCRIPT_DIR/scripts/01_upload_raw_dictionaries.py" \
--input="$RAW_DIC_PATH" \
--version="$DICT_VERSION" \
--aws_profile="$AWS_PROFILE" \
--aws_mfa="$AWS_MFA_ID" \
--dictionary_format "$FORMAT_VERSION"
# build binary dictionaries
if [ "$FORMAT_VERSION" = "v0" ]; then
RELEASE_FLAG="true"
else # v1
RELEASE_FLAG="false"
fi
"$SCRIPT_DIR/gradlew" -Pdict.release=$RELEASE_FLAG -Pdict.format="$FORMAT_VERSION" -Pdict.version="$DICT_VERSION" build
# upload binary dictionaries to s3
python3 "$SCRIPT_DIR/scripts/02_upload_compiled_dictionaries.py" \
--input="$SCRIPT_DIR/build/distributions/$FORMAT_VERSION" \
--version="$DICT_VERSION" \
--aws_profile="$AWS_PROFILE" \
--aws_mfa="$AWS_MFA_ID" \
--dictionary_format "$FORMAT_VERSION"
# build python distributions
if [ "$FORMAT_VERSION" = "v1" ]; then
bash $SCRIPT_DIR/package_python.sh "$FORMAT_VERSION" "$DICT_VERSION" "$PY_PACKAGE_VERSION"
else # v0
>&2 echo "We only kick python packaging for dictionary format version V1."
fi