55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
stages:
|
|
- build
|
|
- release
|
|
|
|
variables:
|
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/installer/"
|
|
|
|
build:
|
|
stage: build
|
|
image: rust:alpine
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "installer"
|
|
script:
|
|
- export CARGO_HOME="${PWD}/.cargo"
|
|
- apk add pkgconf musl-dev
|
|
- RUSTFLAGS='-C target-feature=+crt-static -C link-self-contained=yes -C link-arg=-s' cargo build --release --target x86_64-unknown-linux-musl
|
|
- cp target/x86_64-unknown-linux-musl/release/dotfiles_installer ./installer-amd64
|
|
artifacts:
|
|
paths:
|
|
- installer-amd64
|
|
cache:
|
|
paths:
|
|
- .cargo/
|
|
|
|
|
|
upload_assets:
|
|
stage: release
|
|
image: curlimages/curl:latest
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "installer"
|
|
needs:
|
|
- job: build
|
|
artifacts: true
|
|
script:
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file installer-amd64 "${PACKAGE_REGISTRY_URL}/dev-$CI_COMMIT_SHORT_SHA/installer-amd64"'
|
|
|
|
create_release:
|
|
stage: release
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "installer"
|
|
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'
|
|
url: '${PACKAGE_REGISTRY_URL}/dev-$CI_COMMIT_SHORT_SHA/installer-amd64'
|
|
link_type: package
|
|
|