dotfiles/.gitlab-ci.yml

69 lines
2.1 KiB
YAML
Raw Normal View History

2023-01-20 15:43:17 +00:00
stages:
- build
- release
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/insatller/"
build_glibc:
stage: build
image: rust:bullseye
rules:
- if: $CI_COMMIT_BRANCH == "installer"
2023-01-20 15:43:17 +00:00
script:
- cargo build --release
2023-01-20 15:48:49 +00:00
- cp target/release/dotfiles_installer ./installer-amd64-glibc
2023-01-20 15:43:17 +00:00
artifacts:
paths:
- installer-amd64-glibc
build_muslc:
stage: build
image: rust:alpine
rules:
- if: $CI_COMMIT_BRANCH == "installer"
2023-01-20 15:43:17 +00:00
script:
- apk add pkgconf musl-dev openssl-dev
2023-01-20 15:43:17 +00:00
- cargo build --release
2023-01-20 15:48:49 +00:00
- cp target/release/dotfiles_installer ./installer-amd64-muslc
2023-01-20 15:43:17 +00:00
artifacts:
paths:
- installer-amd64-muslc
upload_assets:
stage: release
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_BRANCH == "installer"
2023-01-20 15:43:17 +00:00
needs:
- job: build_glibc
artifacts: true
- job: build_muslc
artifacts: true
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file installer-amd64-glibc "${PACKAGE_REGISTRY_URL}/dev-$CI_COMMIT_SHORT_SHA/installer-amd64-glibc"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file installer-amd64-muslc "${PACKAGE_REGISTRY_URL}/dev-$CI_COMMIT_SHORT_SHA/installer-amd64-muslc"'
create_release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_BRANCH == "installer"
2023-01-20 15:43:17 +00:00
needs:
- upload_assets
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: 'dev-$CI_COMMIT_SHORT_SHA'
description: 'Release dev-$CI_COMMIT_SHORT_SHA'
assets:
links:
- name: 'installer-amd64-glibc'
url: '${PACKAGE_REGISTRY_URL}/dev-$CI_COMMIT_SHORT_SHA/installer-amd64-glibc'
link_type: package
- name: 'installer-amd64-muslc'
url: '${PACKAGE_REGISTRY_URL}/dev-$CI_COMMIT_SHORT_SHA/installer-amd64-muslc'
link_type: package