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

71 lines
1.6 KiB
YAML
Raw Normal View History

2023-02-26 22:01:27 +00:00
image: 3.10.8-slim-buster
2023-06-19 20:52:55 +00:00
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux/$CI_COMMIT_TAG/"
2023-02-26 22:01:27 +00:00
.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
2023-06-19 20:52:55 +00:00
- upload
2023-02-26 22:01:27 +00:00
- release
## Docker steps
build:
image: rust:bullseye
2023-02-26 22:01:27 +00:00
stage: build
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
CACHING:
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 23:26:27 +00:00
- mkdir ./artifacts
- cp /builds/Neshura/cloudflare-dns-updater/target/release/cloudflare-dns-updater ./artifacts/
2023-02-26 22:21:44 +00:00
2023-02-26 22:01:27 +00:00
artifacts:
paths:
2023-02-26 23:29:44 +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]
2023-06-19 20:52:55 +00:00
upload:
2023-02-26 22:01:27 +00:00
needs:
2023-06-19 20:52:55 +00:00
- job: build
artifacts: true
image: curlimages/curl:latest
stage: upload
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file artifacts/cloudflare-dns-updater "${PACKAGE_REGISTRY_URL}/cloudflare-dns-updater"
rules:
- !reference [.deploy, rules]
Tag Release:
2023-02-26 22:01:27 +00:00
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-06-19 20:52:55 +00:00
- name: "cloudflare-dns-updater"
url: "${PACKAGE_REGISTRY_URL}/cloudflare-dns-updater"
2023-02-26 22:01:27 +00:00