modify build script and update ci
This commit is contained in:
parent
05aaa8fb52
commit
14dadd779f
|
@ -1,9 +1,13 @@
|
|||
pipeline:
|
||||
bin-pack:
|
||||
image: debian:stable-slim
|
||||
image: debian-pack:0.1
|
||||
secrets:
|
||||
- WEBDAV_USER
|
||||
- WEBDAV_PASS
|
||||
- WEBDAV_HOST
|
||||
- WEBDAV_REPOPATH
|
||||
commands:
|
||||
- source script/build_single.sh
|
||||
- build_single ${BIN_PACK}
|
||||
- ./script/build_single.sh $BIN_PACK
|
||||
|
||||
matrix:
|
||||
BIN_PACK:
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
pipeline:
|
||||
dendrite:
|
||||
image: golang
|
||||
secrets:
|
||||
- WEBDAV_USER
|
||||
- WEBDAV_PASS
|
||||
- WEBDAV_HOST
|
||||
- WEBDAV_REPOPATH
|
||||
commands:
|
||||
- source script/build_single.sh
|
||||
- build_single dendrite
|
||||
- ./script/build_single.sh dendrite
|
||||
|
||||
static-deployer-git:
|
||||
image: debian:stable-slim
|
||||
image: debian-pack:0.1
|
||||
secrets:
|
||||
- WEBDAV_USER
|
||||
- WEBDAV_PASS
|
||||
- WEBDAV_HOST
|
||||
- WEBDAV_REPOPATH
|
||||
commands:
|
||||
- source script/build_single.sh
|
||||
- build_single static-deployer-git
|
||||
- ./script/build_single.sh static-deployer-git
|
||||
|
||||
|
|
6
.woodpecker/debian-pack.df
Normal file
6
.woodpecker/debian-pack.df
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM debian:bullseye-slim
|
||||
|
||||
RUN apt update && \
|
||||
apt install --yes curl ca-certificates && \
|
||||
apt clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
49
script/build_all.sh
Normal file → Executable file
49
script/build_all.sh
Normal file → Executable file
|
@ -1,53 +1,6 @@
|
|||
#!/usr/bin/evn bash
|
||||
#
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
|
||||
WEBDAV_USER=${WEBDAV_USER:?WEBDAV_USER not set}
|
||||
WEBDAV_PASS=${WEBDAV_PASS:?WEBDAV_PASS not set}
|
||||
WEBDAV_HOST=${WEBDAV_HOST:?WEBDAV_HOST not set}
|
||||
WEBDAV_REPOPATH=${WEBDAV_REPOPATH:?WEBDAV_REPOPATH not set}
|
||||
|
||||
function curl_alias {
|
||||
curl --show-error --silent --user "${WEBDAV_USER}:${WEBDAV_PASS}" "$@"
|
||||
}
|
||||
|
||||
function webdav_is_file_exists {
|
||||
local target="${1%/}"
|
||||
local target="${target#/}"
|
||||
local resp=$(curl_alias --head --write-out "%{http_code}" "${WEBDAV_HOST}/${WEBDAV_REPOPATH}/${target}" | tail -n 1)
|
||||
[[ "${resp}" == "200" ]]
|
||||
}
|
||||
|
||||
function webdav_mkcol {
|
||||
local dirname="${1#/}"
|
||||
curl_alias --request MKCOL "${WEBDAV_HOST}/${dirname}"
|
||||
}
|
||||
|
||||
function webdav_upload_file {
|
||||
curl_alias --silent --upload-file "$1" "${WEBDAV_HOST}/${WEBDAV_REPOPATH}/$2"
|
||||
echo "file $1 uploaded to ${WEBDAV_HOST}/${WEBDAV_REPOPATH}/$2"
|
||||
}
|
||||
|
||||
function build_single {
|
||||
(
|
||||
local package_name="$1"
|
||||
local package_path="$(realpath "$1")"
|
||||
cd "$package_path"
|
||||
local target_filename="$(../makedeb/makedeb -STF | tail -n 1)"
|
||||
|
||||
if webdav_is_file_exists "${target_filename}" ; then
|
||||
echo "${package_name} already built, skipped."
|
||||
return
|
||||
fi
|
||||
|
||||
../makedeb/makedeb
|
||||
|
||||
webdav_upload_file "${target_filename}" "${target_filename}"
|
||||
)
|
||||
}
|
||||
|
||||
source $(dirname $0)/util.sh
|
||||
|
||||
for i in $(find . -maxdepth 1 -mindepth 1 -type d -not -path './script' -not -path './makedeb' -not -name '.*')
|
||||
do
|
||||
|
|
5
script/build_single.sh
Executable file
5
script/build_single.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source $(dirname $0)/util.sh
|
||||
|
||||
build_single $1
|
49
script/util.sh
Normal file
49
script/util.sh
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/evn bash
|
||||
#
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
|
||||
WEBDAV_USER=${WEBDAV_USER:?WEBDAV_USER not set}
|
||||
WEBDAV_PASS=${WEBDAV_PASS:?WEBDAV_PASS not set}
|
||||
WEBDAV_HOST=${WEBDAV_HOST:?WEBDAV_HOST not set}
|
||||
WEBDAV_REPOPATH=${WEBDAV_REPOPATH:?WEBDAV_REPOPATH not set}
|
||||
|
||||
function curl_alias {
|
||||
curl --show-error --silent --user "${WEBDAV_USER}:${WEBDAV_PASS}" "$@"
|
||||
}
|
||||
|
||||
function webdav_is_file_exists {
|
||||
local target="${1%/}"
|
||||
local target="${target#/}"
|
||||
local resp=$(curl_alias --head --write-out "%{http_code}" "${WEBDAV_HOST}/${WEBDAV_REPOPATH}/${target}" | tail -n 1)
|
||||
[[ "${resp}" == "200" ]]
|
||||
}
|
||||
|
||||
function webdav_mkcol {
|
||||
local dirname="${1#/}"
|
||||
curl_alias --request MKCOL "${WEBDAV_HOST}/${dirname}"
|
||||
}
|
||||
|
||||
function webdav_upload_file {
|
||||
curl_alias --silent --upload-file "$1" "${WEBDAV_HOST}/${WEBDAV_REPOPATH}/$2"
|
||||
echo "file $1 uploaded to ${WEBDAV_HOST}/${WEBDAV_REPOPATH}/$2"
|
||||
}
|
||||
|
||||
function build_single {
|
||||
(
|
||||
local package_name="$1"
|
||||
local package_path="$(realpath "$1")"
|
||||
cd "$package_path"
|
||||
local target_filename="$(../makedeb/makedeb -STF | tail -n 1)"
|
||||
|
||||
if webdav_is_file_exists "${target_filename}" ; then
|
||||
echo "${package_name} already built, skipped."
|
||||
return
|
||||
fi
|
||||
|
||||
../makedeb/makedeb
|
||||
|
||||
webdav_upload_file "${target_filename}" "${target_filename}"
|
||||
)
|
||||
}
|
Loading…
Reference in a new issue