Commit 76b6b01f authored by Manuel Moos's avatar Manuel Moos
Browse files

Add deploy to gitlab package repository

parent 0a33800e
Pipeline #239683004 passed with stages
in 37 minutes and 42 seconds
......@@ -304,6 +304,7 @@ deploy_release:
- ./docker/scripts/fix_gits.sh || exit $?
- ./docker/deploy/prepare_deploy.sh || exit $?
script:
# test whether we're current
- docker/scripts/obsolete.sh || exit 0
# build
......@@ -369,6 +370,25 @@ deploy_docker:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY 2>&1 | grep -v WARNING\|credential || exit $?
- make -C gitlab_build/docker/build unstaged_deploy_docker.tag || exit $?
# deploy build to Gitlab
deploy_gitlab:
stage: deploy
dependencies:
- build_prepare
- build_collect
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- if: $CI_COMMIT_REF_PROTECTED == "true"
when: on_success
- when: never
script:
# test whether we're current
- docker/scripts/obsolete.sh || exit 0
# deploy
- make -C gitlab_build/docker/build unstaged_deploy_gitlab || exit $?
# post-build tests
post_test:
stage: build_collect
......
......@@ -675,6 +675,15 @@ context.deploy_steam: context.deploy_base_steam ${srcdir}/../deploy/steamcontent
echo "steamcmd" > $@.dir/image
echo > $@
context.deploy_gitlab: context.deploy_base_gitlab Makefile
${srcdir}/prepare_context.sh $@.dir $<.dir/'*'
echo "#/bin/bash" > $@.dir/CI_INFO_DEPLOY_GITLAB
echo "CI_JOB_TOKEN=${CI_JOB_TOKEN}" >> $@.dir/CI_INFO_DEPLOY_GITLAB
echo "CI_API_V4_URL=${CI_API_V4_URL}" >> $@.dir/CI_INFO_DEPLOY_GITLAB
echo "CI_PROJECT_ID=${CI_PROJECT_ID}" >> $@.dir/CI_INFO_DEPLOY_GITLAB
chmod 755 $@.dir/CI_INFO_DEPLOY_GITLAB
echo > $@
context.deploy_ppa_%: result.debsrc_% ${srcdir}/../deploy/deploy_ppa.sh ../deploy/targets.sh CI_INFO
${srcdir}/prepare_context.sh $@.dir $<.dir/'*' ${srcdir}/../deploy/deploy_ppa.sh ../deploy/targets.sh ../deploy/secrets/*.gpg CI_INFO
echo > $@
......@@ -733,6 +742,7 @@ result.deploy_download: deploy_external
# individual deploy targets
deploy_lp: result.deploy_lp
deploy_scp: result.deploy_scp
deploy_gitlab: result.deploy_gitlab
deploy_steam: result.deploy_steam
deploy_zi: result.deploy_zi
deploy_fp: result.deploy_fp
......@@ -765,7 +775,7 @@ staged_%:
sed -i ../deploy/targets.sh -e "s/STAGING=false/STAGING=true/"
MAKE=$(MAKE) ${srcdir}/make_deploy.sh $*
.PHONY: deploy deploy_ppa deploy_scp deploy_steam deploy_base deploy_download
.PHONY: deploy deploy_ppa deploy_scp deploy_gitlab deploy_steam deploy_base deploy_download
.PRECIOUS: context.debsrc_dapper \
context.debsrc_bionic result.debsrc_bionic context.deploy_ppa_bionic result.deploy_ppa_bionic \
......@@ -775,6 +785,7 @@ context.debsrc_focal result.debsrc_focal context.deploy_ppa_focal result.depl
context.debsrc_groovy result.debsrc_groovy context.deploy_ppa_groovy result.deploy_ppa_groovy \
context.debsrc_hirsute result.debsrc_hirsute context.deploy_ppa_hirsute result.deploy_ppa_hirsute \
context.deploy_base_scp context.deploy_scp \
context.deploy_base_gitlab context.deploy_gitlab \
context.deploy_base_download result.deploy_download context.deploy_download
#***************************************************************
......
#!/bin/bash
# push upload directory to gitlab release
. ./version.sh || exit $?
. ./targets.sh || exit $?
. CI_INFO_DEPLOY_GITLAB || exit $?
set -x
# gitlab only accepts NUMBER.NUMBER.NUMBER
# Replace all non-number sequences by dots
# pad numbers to two digits
# remove leading 0
# only leave the first three dots
GITLAB_VERSION=`echo ${PACKAGE_VERSION} | sed -e 's,[[:alpha:]_]\+,.,g' -e 's,\.\([0-9]\)\.,.0\1.,g' -e 's,\.\([0-9]\)\.,.0\1.,g' -e 's,\.\([0-9]\)\.,.0\1.,g' -e 's,^0.,0,' -e 's,\.,,3g'` || exit $?
if ${STAGING} == true; then
exit 0
fi
function upload(){
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $1 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${GITLAB_VERSION}/`basename $1`"
}
EXIT=0
for f in upload/*.AppImage upload/*.exe upload/${PACKAGE_NAME}-${PACKAGE_VERSION}*.tbz upload/*source*.zip; do
if test -r $f; then
upload $f || EXIT=$?
fi
done
rm -rf source upload ulb secrets ~/.ssh
exit ${EXIT}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment