mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-01 00:03:18 +01:00
CI: publish a new release in Gitlab on new tag
This commit is contained in:
parent
e985f50d8a
commit
06654969d0
3 changed files with 59 additions and 0 deletions
|
@ -2,11 +2,13 @@ stages:
|
||||||
- tests
|
- tests
|
||||||
- build
|
- build
|
||||||
- publish
|
- publish
|
||||||
|
- release
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
DOC_BRANCH: doc
|
DOC_BRANCH: doc
|
||||||
DOC_REMOTE: https://gitlab-ci-token:${ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
|
DOC_REMOTE: https://gitlab-ci-token:${ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
|
||||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||||
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}"
|
||||||
|
|
||||||
tests:bookworm:
|
tests:bookworm:
|
||||||
image:
|
image:
|
||||||
|
@ -125,6 +127,7 @@ build:debian-stable:
|
||||||
script:
|
script:
|
||||||
- ./build-deb.sh --install-build-deps
|
- ./build-deb.sh --install-build-deps
|
||||||
- rm -fr dist/ldapsaisie-*
|
- rm -fr dist/ldapsaisie-*
|
||||||
|
- dpkg-parsechangelog --format dpkg|awk '/ ldapsaisie /,0'|tail -n +3 > dist/release-notes.md
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- dist/*
|
- dist/*
|
||||||
|
@ -300,6 +303,22 @@ publish:debian-stable:
|
||||||
- echo "Publish stable debian packages on APT repository..."
|
- echo "Publish stable debian packages on APT repository..."
|
||||||
- dupload --to debian-stable dist/ldapsaisie*changes
|
- dupload --to debian-stable dist/ldapsaisie*changes
|
||||||
|
|
||||||
|
publish:gitlab:
|
||||||
|
stage: publish
|
||||||
|
image:
|
||||||
|
name: docker.io/alpine/httpie
|
||||||
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
|
needs:
|
||||||
|
- build:debian-stable
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
script:
|
||||||
|
- ./.gitlab/publish.sh
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- dist/release-notes.md
|
||||||
|
- dist/release-files.txt
|
||||||
|
|
||||||
publish:debian-sid:
|
publish:debian-sid:
|
||||||
stage: publish
|
stage: publish
|
||||||
image: debian:stable-slim
|
image: debian:stable-slim
|
||||||
|
@ -318,3 +337,15 @@ publish:debian-sid:
|
||||||
script:
|
script:
|
||||||
- echo "Publish Sid debian packages on APT repository..."
|
- echo "Publish Sid debian packages on APT repository..."
|
||||||
- dupload --to debian-sid dist/ldapsaisie*changes
|
- dupload --to debian-sid dist/ldapsaisie*changes
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
image:
|
||||||
|
name: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
|
needs:
|
||||||
|
- publish:gitlab
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
script:
|
||||||
|
- ./.gitlab/release.sh
|
||||||
|
|
14
.gitlab/publish.sh
Executable file
14
.gitlab/publish.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd `dirname $0`/../dist
|
||||||
|
rm -f release-files.txt
|
||||||
|
touch release-files.txt
|
||||||
|
|
||||||
|
for file in *.deb
|
||||||
|
do
|
||||||
|
# The filename can contain only lowercase letters (a-z), uppercase letter (A-Z), numbers (0-9), dots (.),
|
||||||
|
# hyphens (-), or underscores (_).
|
||||||
|
filename=`echo $file|tr '~' '_'|tr '+' '_'|sed s/[^a-zA-Z0-9\.\_\-]//g`
|
||||||
|
https --ignore-stdin --check-status PUT "${PACKAGE_REGISTRY_URL}/${filename}" "JOB-TOKEN: $CI_JOB_TOKEN" "@$file"
|
||||||
|
echo $filename >> release-files.txt
|
||||||
|
done
|
14
.gitlab/release.sh
Executable file
14
.gitlab/release.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Creating a release for $CI_COMMIT_TAG"
|
||||||
|
|
||||||
|
cd `dirname $0`/../dist
|
||||||
|
|
||||||
|
|
||||||
|
CMD="release-cli create --name $CI_COMMIT_TAG --description release-notes.md --tag-name $CI_COMMIT_TAG"
|
||||||
|
for file in `cat release-files.txt`
|
||||||
|
do
|
||||||
|
CMD="$CMD --assets-link {\"name\":\"$file\",\"url\":\"${PACKAGE_REGISTRY_URL}/$file\"}"
|
||||||
|
done
|
||||||
|
|
||||||
|
$CMD
|
Loading…
Reference in a new issue