From 3a7165778a715cd96e2ab24816468b8dbeabe750 Mon Sep 17 00:00:00 2001 From: morph027 Date: Mon, 17 Jan 2022 08:55:54 +0100 Subject: [PATCH] add arm64 builds, refs #5 Signed-off-by: morph027 --- .gitlab-ci.yml | 63 +++++++++++++------ .../before-install.sh | 0 {package_scripts => .packaging}/gitea.service | 0 {repo => .repo}/conf/distributions | 2 +- 4 files changed, 44 insertions(+), 21 deletions(-) rename package_scripts/after-install.sh => .packaging/before-install.sh (100%) rename {package_scripts => .packaging}/gitea.service (100%) rename {repo => .repo}/conf/distributions (72%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d62b85..543e1ab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,38 @@ +--- stages: - package - test - - repo + - .repo - pages -package: +.vars: &vars + NAME: gitea + URL: "https://gitea.io" + DESCRIPTION: "A painless self-hosted Git service." + ARTIFACTS: "usr" + +.package: &package stage: package image: golang:latest - variables: - NAME: gitea - URL: "https://gitea.io" - DESCRIPTION: "A painless self-hosted Git service." - ARTIFACTS: "usr" script: - - export VERSION=$(echo ${CI_COMMIT_TAG#*v} | cut -d'-' -f1) - - export PATCHLEVEL=$(echo ${CI_COMMIT_TAG} | cut -d'-' -f2) + - 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-amd64" - - file --mime-type --brief "${CI_PROJECT_DIR}/package_root/usr/bin/gitea" | grep -q 'application/x-executable' + - 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}_amd64.deb" @@ -33,12 +42,12 @@ package: --maintainer "Stefan Heitmüller " --url "${URL}" --depends git - --deb-systemd "${CI_PROJECT_DIR}/package_scripts/${NAME}.service" + --deb-systemd "${CI_PROJECT_DIR}/.packaging/${NAME}.service" --deb-systemd-enable --deb-systemd-auto-start --deb-activate-noawait /etc/init.d --prefix=/ - --after-install "${CI_PROJECT_DIR}/package_scripts/after-install.sh" + --before-install "${CI_PROJECT_DIR}/.packaging/before-install.sh" --chdir "${CI_PROJECT_DIR}/package_root" $ARTIFACTS artifacts: @@ -47,6 +56,18 @@ package: only: - tags +gitea-amd64: + <<: *package + variables: + <<: *vars + ARCH: amd64 + +gitea-arm64: + <<: *package + variables: + <<: *vars + ARCH: arm64 + test-install: stage: test image: docker:latest @@ -89,19 +110,19 @@ reprepro: cache: untracked: true paths: - - $CI_PROJECT_DIR/repo + - $CI_PROJECT_DIR/.repo key: reprepro - stage: repo + stage: .repo 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 + - 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 - find $CI_PROJECT_DIR -type f -name "*.deb" -exec reprepro - -b $CI_PROJECT_DIR/repo + -b $CI_PROJECT_DIR/.repo includedeb gitea {} \+; @@ -112,14 +133,16 @@ pages: cache: untracked: true paths: - - $CI_PROJECT_DIR/repo + - $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/dists $CI_PROJECT_DIR/repo/pool $CI_PROJECT_DIR/public/ + - cp -r + $CI_PROJECT_DIR/.repo/{gpg.key,dists,pool} + $CI_PROJECT_DIR/public/ artifacts: paths: - $CI_PROJECT_DIR/public diff --git a/package_scripts/after-install.sh b/.packaging/before-install.sh similarity index 100% rename from package_scripts/after-install.sh rename to .packaging/before-install.sh diff --git a/package_scripts/gitea.service b/.packaging/gitea.service similarity index 100% rename from package_scripts/gitea.service rename to .packaging/gitea.service diff --git a/repo/conf/distributions b/.repo/conf/distributions similarity index 72% rename from repo/conf/distributions rename to .repo/conf/distributions index 397750b..2b5e594 100644 --- a/repo/conf/distributions +++ b/.repo/conf/distributions @@ -1,5 +1,5 @@ Codename: gitea Components: main -Architectures: amd64 +Architectures: amd64 arm64 SignWith: ##SIGNING_KEY_ID## Limit: 0