Update .gitlab-ci.yml file

This commit is contained in:
Neshura 2023-06-19 20:01:15 +00:00
parent 87d40b4ea7
commit 8e47c99ce1

View file

@ -18,37 +18,42 @@ build:
variables: variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH
CACHING: CACHING:
script: script:
- echo "Compiling the code..." - echo "Compiling the code..."
- cargo build -r - cargo build -r
- echo "Compile complete." - echo "Compile complete."
after_script: after_script:
- echo JOB_ID=$CI_JOB_ID >> job.env - echo JOB_ID=$CI_JOB_ID >> job.env
- mkdir ./artifacts - mkdir ./artifacts
- cp /builds/Neshura/ascendance-of-a-bookworm-bot/target/release/ascendance-of-a-bookworm-bot ./artifacts/ - cp /builds/Neshura/ascendance-of-a-bookworm-bot/target/release/ascendance-of-a-bookworm-bot ./artifacts/
artifacts: artifacts:
paths: paths:
- ./artifacts/ - ./artifacts/
reports: reports:
dotenv: job.env dotenv: job.env
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/ascendance-of-a-bookworm-bot "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux/$CI_COMMIT_TAG/ascendance-of-a-bookworm-bot"'
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:
- !reference [.deploy, rules] - !reference [.deploy, rules]
script: script:
- apk add curl
- echo "running Release Job, attaching Artifact from Job $JOB_ID" - echo "running Release Job, attaching Artifact from Job $JOB_ID"
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file artifacts/ascendance-of-a-bookworm-bot "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux/$CI_COMMIT_TAG/ascendance-of-a-bookworm-bot"'
release: release:
tag_name: '$CI_COMMIT_TAG' tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG' description: '$CI_COMMIT_TAG'