1
0
mirror of https://gitlab.com/packaging/gitea synced 2024-12-22 18:14:12 +00:00
gitea_packaging/.gitlab-ci.yml

154 lines
3.7 KiB
YAML
Raw Permalink Normal View History

---
2020-04-12 11:43:49 +00:00
stages:
- package
2020-06-20 08:55:39 +00:00
- test
- .repo
2020-04-12 11:43:49 +00:00
- pages
.vars: &vars
NAME: gitea
URL: "https://gitea.io"
DESCRIPTION: "A painless self-hosted Git service."
ARTIFACTS: "usr"
.package: &package
2020-04-12 11:43:49 +00:00
stage: package
image: golang:latest
script:
- export VERSION=$(echo ${CI_COMMIT_TAG#*v} | cut -d'-' -f1)
- export PATCHLEVEL=$(echo ${CI_COMMIT_TAG} | cut -d'-' -f2)
2020-04-12 11:43:49 +00:00
- apt-get -qq update
2020-06-19 05:14:57 +00:00
- apt-get -qqy install ruby-dev ruby-ffi curl file
2020-04-12 11:43:49 +00:00
- gem install specific_install
- gem specific_install https://github.com/root360/fpm.git all_fixes
- mkdir -p "${CI_PROJECT_DIR}/package_root/usr/bin"
- curl -sL -o
"${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
"https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-${ARCH}"
- file
--mime-type
--brief
"${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
| grep -q 'application/x-executable'
2020-04-12 11:43:49 +00:00
- chmod +x "${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
- fpm
--architecture "${ARCH}"
2020-04-12 11:43:49 +00:00
--input-type dir
--output-type deb
--package "${CI_PROJECT_DIR}/gitea_${VERSION}-${PATCHLEVEL}_${ARCH}.deb"
2020-04-12 11:43:49 +00:00
--name "${NAME}"
2020-05-10 11:47:03 +00:00
--version "${VERSION}-${PATCHLEVEL}"
2020-04-12 11:43:49 +00:00
--description "${DESCRIPTION}"
--maintainer "Stefan Heitmüller <stefan.heitmueller@gmx.com>"
--url "${URL}"
--depends git
--deb-systemd "${CI_PROJECT_DIR}/.packaging/${NAME}.service"
2020-04-12 11:43:49 +00:00
--deb-activate-noawait /etc/init.d
--prefix=/
--before-install "${CI_PROJECT_DIR}/.packaging/before-install.sh"
2020-04-12 11:43:49 +00:00
--chdir "${CI_PROJECT_DIR}/package_root"
$ARTIFACTS
artifacts:
paths:
- $CI_PROJECT_DIR/*.deb
only:
- tags
gitea-amd64:
<<: *package
variables:
<<: *vars
ARCH: amd64
gitea-arm64:
<<: *package
variables:
<<: *vars
ARCH: arm64
2020-06-20 12:39:39 +00:00
test-install:
2020-06-20 08:55:39 +00:00
stage: test
image: docker:latest
services:
- docker:dind
needs:
- gitea-amd64
2020-06-20 08:55:39 +00:00
script:
- docker run
-d
--name systemd-ubuntu
--privileged
-v /sys/fs/cgroup:/sys/fs/cgroup:ro
-v $CI_PROJECT_DIR:/src
-e CI_PROJECT_DIR=/src
2020-06-20 09:13:42 +00:00
-e CI_COMMIT_TAG=$CI_COMMIT_TAG
2020-06-20 08:55:39 +00:00
jrei/systemd-ubuntu:20.04
2020-06-20 12:39:39 +00:00
- docker exec -t systemd-ubuntu /bin/bash /src/.gitlab-ci/test-install.sh
only:
- tags
test-update:
stage: test
image: docker:latest
services:
- docker:dind
needs:
- gitea-amd64
2020-06-20 12:39:39 +00:00
script:
- docker run
-d
--name systemd-ubuntu
--privileged
-v /sys/fs/cgroup:/sys/fs/cgroup:ro
-v $CI_PROJECT_DIR:/src
-e CI_PROJECT_DIR=/src
-e CI_COMMIT_TAG=$CI_COMMIT_TAG
jrei/systemd-ubuntu:20.04
- docker exec -t systemd-ubuntu /bin/bash /src/.gitlab-ci/test-update.sh
2020-06-20 08:55:39 +00:00
only:
- tags
2020-04-12 11:43:49 +00:00
reprepro:
cache:
untracked: true
paths:
- $CI_PROJECT_DIR/.repo
2020-04-12 11:43:49 +00:00
key: reprepro
stage: .repo
2020-04-12 11:43:49 +00:00
image: registry.gitlab.com/packaging/reprepro-multiple-versions:latest
script:
- echo "$SIGNING_KEY" > /tmp/key
- gpg --import /tmp/key
- rm -f /tmp/key
- test -f $CI_PROJECT_DIR/.repo/gpg.key || gpg --export --armor "$SIGNING_KEY_ID" > $CI_PROJECT_DIR/.repo/gpg.key
- sed -i 's,##SIGNING_KEY_ID##,'$SIGNING_KEY_ID',' .repo/conf/distributions
2020-04-12 11:43:49 +00:00
- find $CI_PROJECT_DIR -type f -name "*.deb" -exec
reprepro
-b $CI_PROJECT_DIR/.repo
2020-04-12 11:43:49 +00:00
includedeb
gitea
{} \+;
only:
- tags
pages:
cache:
untracked: true
paths:
- $CI_PROJECT_DIR/.repo
2020-04-12 11:43:49 +00:00
key: reprepro
policy: pull
stage: pages
image: ubuntu:focal
script:
- mkdir $CI_PROJECT_DIR/public
- cp -r
$CI_PROJECT_DIR/.repo/{gpg.key,dists,pool}
$CI_PROJECT_DIR/public/
2020-04-12 11:43:49 +00:00
artifacts:
paths:
- $CI_PROJECT_DIR/public
expire_in: 1 day
only:
- tags