-
Notifications
You must be signed in to change notification settings - Fork 45
/
update.sh
executable file
·39 lines (28 loc) · 1.07 KB
/
update.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
#!/bin/bash
set -euf -o pipefail
function clean_up {
find "$1" -name "*.bak" -type f -delete
}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
trap 'clean_up "${SCRIPT_DIR}"' EXIT
function display_help {
echo ""
echo -e "Usage: $(basename "${0}") version"
echo ""
echo " version: version number of micromamba to put into files"
echo ""
}
if [[ $# -ne 1 ]]; then
display_help
exit 128
fi
VERSION="${1}"
DATE="$(date "+%-d %B %Y")"
DOCKERFILES=$(find "${SCRIPT_DIR}" -not -path "./test/bats/*" -name '*Dockerfile')
for f in $DOCKERFILES; do
sed -i.bak "s%^FROM mambaorg/micromamba:[^ \t ]*%FROM mambaorg/micromamba:${VERSION}%" "$f"
sed -i.bak "s%^ARG VERSION=[^ \t]*%ARG VERSION=${VERSION}%" "$f"
done
sed -i.bak "s%mambaorg/micromamba:[^ \t ]*%mambaorg/micromamba:${VERSION}%" "examples/generate_lock/generate_lock.sh"
sed -i.bak "s%\(CHANGELOG.md).\)%\1\n\n## ${DATE}\n\n- Updated to micromamba version ${VERSION}%" "${SCRIPT_DIR}/CHANGELOG.md"
sed -i.bak "s%^release = '.*'$%release = '${VERSION}'%" "${SCRIPT_DIR}/docs/conf.py"