1
0
mirror of https://gitlab.com/packaging/gitea synced 2024-12-18 08:03:29 +00:00
gitea_packaging/.gitlab-ci.yml
morph027 6e8272fe38
update version scheme
Signed-off-by: morph027 <stefan.heitmueller@gmx.com>
2023-05-27 07:12:41 +02:00

148 lines
3.5 KiB
YAML

---
stages:
- package
- test
- repo
- pages
.vars: &vars
NAME: gitea
URL: "https://gitea.io"
DESCRIPTION: "A painless self-hosted Git service."
ARTIFACTS: "usr"
.package: &package
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)
- apt-get -qq update
- apt-get -qqy install ruby-dev ruby-ffi curl file
- 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'
- chmod +x "${CI_PROJECT_DIR}/package_root/usr/bin/gitea"
- fpm
--architecture "${ARCH}"
--input-type dir
--output-type deb
--package "${CI_PROJECT_DIR}/gitea_${VERSION}+${PATCHLEVEL}_${ARCH}.deb"
--name "${NAME}"
--version "${VERSION}+${PATCHLEVEL}"
--description "${DESCRIPTION}"
--maintainer "Stefan Heitmüller <stefan.heitmueller@gmx.com>"
--url "${URL}"
--depends git
--deb-recommends morph027-keyring
--deb-systemd "${CI_PROJECT_DIR}/.packaging/${NAME}.service"
--deb-activate-noawait /etc/init.d
--prefix=/
--before-install "${CI_PROJECT_DIR}/.packaging/before-install.sh"
--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
test-install:
stage: test
image: docker:latest
services:
- docker:dind
needs:
- gitea-amd64
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-install.sh
only:
- tags
test-update:
stage: test
image: docker:latest
services:
- docker:dind
needs:
- gitea-amd64
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
only:
- tags
reprepro:
cache:
untracked: true
paths:
- $CI_PROJECT_DIR/.repo
key: reprepro
stage: repo
image: registry.gitlab.com/packaging/reprepro-multiple-versions:latest
script:
- apt-get -qq update
- apt-get -qqy install curl
- curl -L https://gitlab.com/packaging/utils/-/raw/main/repo.sh | bash -s -- gitea
only:
- tags
pages:
cache:
untracked: true
paths:
- $CI_PROJECT_DIR/.repo
key: reprepro
policy: pull
stage: pages
image: ubuntu:focal
script:
- mkdir $CI_PROJECT_DIR/public
- cp -r
$CI_PROJECT_DIR/.repo/gpg.key
$CI_PROJECT_DIR/.repo/gitea/{dists,pool}
$CI_PROJECT_DIR/public/
artifacts:
paths:
- $CI_PROJECT_DIR/public
expire_in: 1 day
only:
- tags