From d7841ad48652ef142cbb982604f6b558d551b4ef Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 4 Sep 2022 11:52:32 +0200 Subject: [PATCH] Added muslc build, release on tag --- .gitlab-ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e25bf8..18f106a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,14 +1,10 @@ stages: - build - package + - release -build_backend: +.backend_base: stage: build - image: reg.gitlab.mattv.de/root/docker-images/ubuntu_build_base:latest - cache: - key: backend - paths: - - vcpkg_cache script: - SRC="$PWD" - TMP=$(mktemp -d) @@ -24,6 +20,22 @@ build_backend: paths: - server +build_backend_glibc: + extends: .backend_base + image: reg.gitlab.mattv.de/root/docker-images/ubuntu_build_base:latest + cache: + key: backend_glibc + paths: + - vcpkg_cache + +build_backend_muslc: + extends: .backend_base + image: reg.gitlab.mattv.de/root/docker-images/alpine_build_base:latest + cache: + key: backend_muslc + paths: + - vcpkg_cache + test_and_build_frontend: image: node:latest stage: build @@ -41,19 +53,64 @@ test_and_build_frontend: paths: - frontend/dist/ -package_server: +.package_server: image: alpine:latest stage: package - before_script: [] + artifacts: + paths: + - '*.tar' + +package_server_glibc: + extends: .package_server needs: - - job: build_backend + - job: build_backend_glibc artifacts: true - job: test_and_build_frontend artifacts: true script: - mkdir static - mv frontend/dist/* static/ - artifacts: - paths: - - server - - static/ + - tar -cvf linux-x64-glibc.tar server static + +package_server_muslc: + extends: .package_server + needs: + - job: build_backend_muslc + artifacts: true + - job: test_and_build_frontend + artifacts: true + script: + - mkdir static + - mv frontend/dist/* static/ + - tar -cvf linux-x64-muslc.tar server static + +upload_assets: + stage: release + image: curlimages/curl:latest + needs: + - job: package_server_glibc + artifacts: true + - job: package_server_muslc + artifacts: true + rules: + - if: $CI_COMMIT_TAG + script: + - | + curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "linux-x64-glibc.tar" "${PACKAGE_REGISTRY_URL}/linux-x64-glibc.tar" + - | + curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "linux-x64-muslc.tar" "${PACKAGE_REGISTRY_URL}/linux-x64-muslc.tar" + + + +create_release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - upload_assets + rules: + - if: $CI_COMMIT_TAG + script: + - | + release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ + --assets-link "{\"name\":\"linux-x64-glibc.tar\",\"url\":\"${PACKAGE_REGISTRY_URL}/linux-x64-glibc.tar\"}" \ + --assets-link "{\"name\":\"linux-x64-muslc.tar\",\"url\":\"${PACKAGE_REGISTRY_URL}/linux-x64-muslc.tar\"}"