c4k-website/infrastructure/build/image/resources/functions.sh

30 lines
728 B
Bash
Raw Normal View History

#!/bin/bash
function generate-netrc-file() {
echo "machine $GIT_HOST password $AUTH_TOKEN" > ~/.netrc
}
function get-website-data() {
curl -H "Authorization: token $AUTH_TOKEN" -o $SOURCE_DIR/$1 $GIT_REPO_URL
}
function get-hash-data() {
curl -s -H "Authorization: token $AUTH_TOKEN" $GIT_COMMIT_URL | jq '.sha'
2022-12-02 09:04:09 +00:00
}
function write-hash-data() {
echo $1 > $HASHFILE_DIR/$2
}
function unzip-website-data() {
unzip $SOURCE_DIR/$1 -d $BUILD_DIR
}
function build-website() {
(cd $BUILD_DIR; dir=$(ls); cd $dir; ./generate.sh;)
}
2022-09-30 15:54:26 +00:00
function move-website-files-to-target() {
(cd $BUILD_DIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete target/html/* $WEBSITE_ROOT;)
2022-09-30 15:54:26 +00:00
}