cloudflare-dns-updater/.gitlab-ci.yml

64 lines
1.5 KiB
YAML
Raw Normal View History

2023-02-26 22:01:27 +00:00
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."
2023-02-26 22:21:44 +00:00
after_script:
2023-02-26 22:27:10 +00:00
- echo JOB_ID=$CI_JOB_ID >> job.env
2023-02-26 22:43:14 +00:00
- mkdir artifacts
2023-02-26 22:56:22 +00:00
- cp /builds/Neshura/cloudflare-dns-updater/target/release/cloudflare-dns-updater /artifacts/
- cp /builds/Neshura/cloudflare-dns-updater/config.json /artifacts/
2023-02-26 22:43:14 +00:00
- cp /builds/Neshura/cloudflare-dns-updater/api-key-empty.json /artifacts/api-key.json
- ls /
2023-02-26 22:21:44 +00:00
2023-02-26 22:01:27 +00:00
artifacts:
paths:
2023-02-26 22:37:02 +00:00
- /artifacts
2023-02-26 22:21:44 +00:00
reports:
dotenv: job.env
2023-02-26 22:01:27 +00:00
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:
2023-02-26 22:21:44 +00:00
- echo "running Release Job, attaching Artifact from Job $JOB_ID"
2023-02-26 22:01:27 +00:00
release:
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
2023-02-26 22:04:08 +00:00
assets:
2023-02-26 22:01:27 +00:00
links:
2023-02-26 22:37:02 +00:00
- name: "cloudflare-dns-updater.zip"
2023-02-26 22:01:27 +00:00
url: "https://gitlab.neshweb.net/Neshura/cloudflare-dns-updater/-/jobs/$JOB_ID/artifacts/download"