-
Notifications
You must be signed in to change notification settings - Fork 1
/
automation.sh
executable file
·51 lines (41 loc) · 1.17 KB
/
automation.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
45
46
47
48
49
50
#!/usr/bin/bash
# exit on errors
set -e
### variables
CURRENT_DIR="$(realpath $(dirname $0))"
PKG_DIRS="$(ls -d ${CURRENT_DIR}/*/)"
source ${CURRENT_DIR}/config.env
### CODE
cd ${CURRENT_DIR}
for MICROARCH in ${MICROARCHS[@]}
do
git switch ${MICROARCH}
for PKG_DIR in ${PKG_DIRS}
do
if [[ $(basename ${PKG_DIR}) == 'base' ]]; then
PKG_NAME="gentoo"
else
PKG_NAME=$(basename ${PKG_DIR})
fi
## BUILD IMAGE
echo "########## ${PKG_NAME} (${MICROARCH}) ############"
if [[ -s ${PKG_DIR}create_gentoo_containers.sh ]]
then
${PKG_DIR}create_gentoo_containers.sh
else
echo "ERROR: can't find build script. Exiting..."
exit 1
fi
### SAVE gentoo IMAGES in tar.zst to /tmp for release
if [[ ${PKG_NAME} == "gentoo" ]]
then
echo "########## Saving gentoo:${MICROARCH} image in /tmp ############"
doas podman save ${MAIN_REGISTRY_WITH_USERNAME}/${PKG_NAME}:${MICROARCH} | zstdmt -z > /tmp/${PKG_NAME}-${MICROARCH}-${BUILD_TAG}.tar.zst
ls -lah /tmp
fi
done
done
git switch main
git tag -m "${BUILD_TAG}" ${BUILD_TAG} main
git push ${BUILD_TAG}
echo "Congratulations !!! You may upload tar files and release."