cloudflare-dns-updater/.gitlab-ci.yml
2023-02-26 23:27:10 +01:00

59 lines
1.2 KiB
YAML

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."
after_script:
- echo JOB_ID=$CI_JOB_ID >> job.env
artifacts:
paths:
- /builds/Neshura/cloudflare-dns-updater
reports:
dotenv: job.env
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, attaching Artifact from Job $JOB_ID"
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"