-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
87 lines (82 loc) · 3.49 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
stages:
- build
- deploy
- deploy-to-aur
build-docker-image:
image: docker:latest
stage: build
script:
- docker build -t "${CI_REGISTRY_IMAGE}:latest" .
- docker tag "${CI_REGISTRY_IMAGE}:latest" "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
- docker tag "${CI_REGISTRY_IMAGE}:latest" "${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:latest"
- docker tag "${CI_REGISTRY_IMAGE}:latest" "${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_TAG}"
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker login -u ${DOCKERHUB_USER} -p ${DOCKERHUB_SECRET}
- docker push "${CI_REGISTRY_IMAGE}:latest"
- docker push "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
- docker push "${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:latest"
- docker push "${DOCKERHUB_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_TAG}"
only:
- tags@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
deploy-to-dockerhost:
stage: deploy
image: iffregistry.fz-juelich.de/florianrhiem/iffdocker-deployment-image:latest
script:
- echo "$IFFDOCKER_KEY" > ~/.ssh/iffdocker_key
- echo -e "$CI_JOB_TOKEN\n$CI_REGISTRY_IMAGE:latest\ngitlab-registry-usage-rest" | ssh iffweb.iff.kfa-juelich.de
only:
- tags@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
deploy-to-github:
stage: deploy
image: iffregistry.fz-juelich.de/docker-images/gr-build-images/deploy
variables:
GIT_STRATEGY: none
only:
- master@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
- develop@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
- tags@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
script:
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "${GITHUB_DEPLOY_KEY}" > ~/.ssh/id_rsa
&& echo "github.com ${GITHUB_HOST_KEY}" >> ~/.ssh/known_hosts)
- git clone --mirror "${CI_REPOSITORY_URL}" "${CI_PROJECT_NAME}_mirror"
- cd "${CI_PROJECT_NAME}_mirror";
git push --mirror "[email protected]:sciapp/${CI_PROJECT_NAME}.git";
cd ..
deploy-to-pypi:
stage: deploy
image: python:3-slim
only:
- tags@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
script:
- pip install twine
- echo "[distutils]" > ~/.pypirc;
echo "index-servers =" >> ~/.pypirc;
echo " pypi" >> ~/.pypirc;
echo "[pypi]" >> ~/.pypirc;
echo "username = __token__" >> ~/.pypirc;
echo "password = ${PYPI_DEPLOY_KEY}" >> ~/.pypirc;
- python setup.py sdist
- python setup.py bdist_wheel
- twine upload dist/*
deploy-to-aur:
stage: deploy-to-aur
image: iffregistry.fz-juelich.de/docker-images/gr-build-images/$CI_JOB_NAME
only:
- tags@Scientific-IT-Systems/administration/gitlab-registry-usage-rest
script:
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$AUR_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "aur.archlinux.org $AUR_HOST_KEY" >> ~/.ssh/known_hosts)
- git clone "ssh://[email protected]/python-gitlab-registry-usage-rest.git" "python-gitlab-registry-usage-rest-aur"
- cd "python-gitlab-registry-usage-rest-aur"
- sed -i -e "/^pkgver=/c\pkgver=\"${CI_COMMIT_TAG#v}\"" -e "/^pkgrel=/c\pkgrel=\"1\"" PKGBUILD
- (
source PKGBUILD;
curl -o source -L "${source[0]}";
SHA256SUM="$(sha256sum source | awk '{ print $1 }')";
sed -i "/^sha256sums=/c\sha256sums=(\"${SHA256SUM}\")" PKGBUILD;
)
- makepkg --printsrcinfo > .SRCINFO
- git commit -a -m "Update to version ${CI_COMMIT_TAG#v}"
- git push