From 0d42b955d2115d9acb67be6960010edf2c3f870c Mon Sep 17 00:00:00 2001 From: Neshura Date: Sun, 26 Feb 2023 23:01:27 +0100 Subject: [PATCH] Add ci-cd file --- .gitlab-ci.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..ed7bb6f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,54 @@ +image: 3.10.8-slim-buster + +.deploy: + rules: + # Regex magic copied from Neshura/page-test, only deploys on x.y.z or higher (x.y) Tags + - if: $CI_COMMIT_TAG =~ /^((([\d])+\.){1,2}[\d]+)\s*$/ && $CI_COMMIT_TAG + +stages: + - build + - release + +## Docker steps + +build: + image: rust:alpine3.17 + stage: build + + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH + CACHING: + + before_script: + - apk add musl-dev openssl-dev + + script: + - echo "Compiling the code..." + - cargo build -r + - echo "Compile complete." + + artifacts: + paths: + - cloudflare-dns-updater + + rules: + - !reference [.deploy, rules] + +Tag Release: + needs: + - job: build + artifacts: true + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + rules: + - !reference [.deploy, rules] + script: + - echo "running release job" + release: + tag_name: '$CI_COMMIT_TAG' + description: '$CI_COMMIT_TAG' + assets: + links: + - name: "cloudflare-dns-updater" + url: "https://gitlab.neshweb.net/Neshura/cloudflare-dns-updater/-/jobs/$JOB_ID/artifacts/download" + \ No newline at end of file