Commit c1a4d349 authored by Nigel Kukard's avatar Nigel Kukard

Merge branch 'uploadtag' into 'master'

Automate uploading when a tag is pushed

See merge request !31
parents 7aa618b4 6f29f2d5
Pipeline #650 passed with stages
in 1 minute and 32 seconds
.gitlab-ci.yml export-ignore
.gitattributes export-ignore
......@@ -2,6 +2,7 @@ stages:
- quality
- tests
- install
- upload
......@@ -44,3 +45,32 @@ make-install:
upload-tagged:
stage: install
only:
- /^v[0-9a-z\.]+@[0-9a-z]+/[0-9a-z]+$/
script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update
- apt-get dist-upgrade -y
- apt-get install -y git xz curl lftp gnupg
- cd "$CI_PROJECT_DIR"
- make install
# Import signing key
- echo "$GPG_SIGNKEY" | gpg --import
# Work out naming
- ARCHIVE_NAME=${CI_PROJECT_NAME}-${CI_BUILD_TAG##v}
# Create tar archive
- git archive --format=tar --prefix=${ARCHIVE_NAME}/ ${CI_BUILD_TAG} > ../${ARCHIVE_NAME}.tar
# Create compressed versions
- xz --keep --extreme -9 ../*.tar
# Sign compressed tar files
- gpg --sign --detach-sign --armor ../*.tar.xz
# Upload files, translating .asc into .sign
- lftp -e "set ssl:ca-file '/etc/ssl/certs/ca-certificates.crt'; set net:max-retries '5'; set net:timeout '60'; mkdir '${CI_BUILD_TAG}'; cd '${CI_BUILD_TAG}'; put ../'${ARCHIVE_NAME}.tar.xz' -o '${ARCHIVE_NAME}.tar.xz'; put ../'${ARCHIVE_NAME}.tar.xz.asc' -o '${ARCHIVE_NAME}.tar.xz.sign'; quit" -u "$UPLOAD_CRED" "$UPLOAD_HOST" 2>&1
# Test uploaded files
- curl --fail -o /dev/null "$DOWNLOAD_URL/${CI_BUILD_TAG}/${ARCHIVE_NAME}.tar.xz"
- curl --fail -o /dev/null "$DOWNLOAD_URL/${CI_BUILD_TAG}/${ARCHIVE_NAME}.tar.xz.sign"
* This now needs proper perl POD documentation
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