71 lines
1.6 KiB
YAML
71 lines
1.6 KiB
YAML
# Is performed before the scripts in the stages step
|
|
before_script:
|
|
- source /etc/profile
|
|
|
|
# Defines stages which are to be executed
|
|
stages:
|
|
- build
|
|
- upload
|
|
- release
|
|
|
|
.setup_script: &setup_scripts
|
|
- apt-get -y install rustup libdbus-glib-1-dev
|
|
- rustup default stable
|
|
- cargo install cargo-deb
|
|
|
|
# Stage "build"
|
|
.compile: &compile
|
|
stage: compile
|
|
rules:
|
|
- if: $VERSION
|
|
script:
|
|
- *setup_scripts
|
|
- mkdir -p ./build;cargo deb --output ./build
|
|
artifacts:
|
|
paths:
|
|
- build/*
|
|
untracked: true
|
|
|
|
build:x86_64:
|
|
<<: *compile
|
|
stage: build
|
|
tags:
|
|
- x86_64
|
|
|
|
build:aarch64:
|
|
<<: *compile
|
|
stage: build
|
|
tags:
|
|
- aarch64
|
|
|
|
upload:
|
|
stage: upload
|
|
dependencies:
|
|
- build:x86_64
|
|
- build:aarch64
|
|
rules:
|
|
- if: $VERSION
|
|
script:
|
|
- find ./build -name "*.deb"
|
|
- debs=( $( find ./build -name "*.deb" ) )
|
|
- assets=""
|
|
- for d in ${debs[@]};do
|
|
- file=$( basename ${d} )
|
|
- url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/batalert/${VERSION}/${file}"
|
|
- assets="${assets} --assets-link {\"name\":\"${file}\",\"url\":\"${url}\",\"link_type\":\"other\"} "
|
|
- "curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"${d}\" \"${url}\""
|
|
- done
|
|
- echo "ASSETS_ARG=${assets}" >> assets.env
|
|
artifacts:
|
|
reports:
|
|
dotenv: assets.env
|
|
|
|
release:
|
|
stage: release
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
rules:
|
|
- if: $VERSION
|
|
script:
|
|
- echo "making release!"
|
|
- echo ${ASSETS_ARG}
|
|
- release-cli create --name "Release ${VERSION}" --tag-name "${VERSION}" ${ASSETS_ARG}
|