Update .gitlab-ci.yml file

This commit is contained in:
Neshura 2023-06-19 20:52:55 +00:00
parent 389cd249d6
commit 8367f381b6

View file

@ -1,5 +1,8 @@
image: 3.10.8-slim-buster image: 3.10.8-slim-buster
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux/$CI_COMMIT_TAG/"
.deploy: .deploy:
rules: rules:
# Regex magic copied from Neshura/page-test, only deploys on x.y.z or higher (x.y) Tags # Regex magic copied from Neshura/page-test, only deploys on x.y.z or higher (x.y) Tags
@ -7,6 +10,7 @@ image: 3.10.8-slim-buster
stages: stages:
- build - build
- upload
- release - release
## Docker steps ## Docker steps
@ -28,8 +32,6 @@ build:
- echo JOB_ID=$CI_JOB_ID >> job.env - echo JOB_ID=$CI_JOB_ID >> job.env
- mkdir ./artifacts - mkdir ./artifacts
- cp /builds/Neshura/cloudflare-dns-updater/target/release/cloudflare-dns-updater ./artifacts/ - cp /builds/Neshura/cloudflare-dns-updater/target/release/cloudflare-dns-updater ./artifacts/
- cp /builds/Neshura/cloudflare-dns-updater/config.json ./artifacts/
- cp /builds/Neshura/cloudflare-dns-updater/api-key-empty.json ./artifacts/api-key.json
artifacts: artifacts:
paths: paths:
@ -40,10 +42,19 @@ build:
rules: rules:
- !reference [.deploy, rules] - !reference [.deploy, rules]
Tag Release: upload:
needs: needs:
- job: build - job: build
artifacts: true 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:
stage: release stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
rules: rules:
@ -55,6 +66,6 @@ Tag Release:
description: '$CI_COMMIT_TAG' description: '$CI_COMMIT_TAG'
assets: assets:
links: links:
- name: "cloudflare-dns-updater.zip" - name: "cloudflare-dns-updater"
url: "https://gitlab.neshweb.net/Neshura/cloudflare-dns-updater/-/jobs/$JOB_ID/artifacts/download" url: "${PACKAGE_REGISTRY_URL}/cloudflare-dns-updater"