add release pipeline with dist tarballs

Fixes #9
This commit is contained in:
Bjarne von Horn 2024-02-02 09:41:18 +01:00
parent 13cef2b981
commit 6b95e42844
1 changed files with 41 additions and 0 deletions

View File

@ -6,6 +6,10 @@ stages:
- test
- doc
- deploy
- release
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ethercat/${CI_COMMIT_TAG}"
build:
stage: build
@ -21,6 +25,10 @@ build:
- ../configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat
- make -j8 all modules
artifacts:
paths:
- ethercat-*.tar.gz
- ethercat-*.tar.bz2
# Build ethercat tool subcommand help output for documentation
commands:
@ -92,6 +100,39 @@ update docs server:
- if: $CI_COMMIT_BRANCH == "stable-1.5" && $CI_PROJECT_NAMESPACE == "etherlab.org"
trigger: etherlab.org/docs
upload:
stage: deploy
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
dependencies:
- "build"
script:
- echo "$CI_COMMIT_TAG" | grep -qE '^[0-9]+(\.[0-9]+){2}$'
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--header "Content-Type: application/gzip" \
--fail-with-body \
--upload-file "ethercat-${CI_COMMIT_TAG}.tar.gz" \
"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.gz"
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--header "Content-Type: application/x-bzip2" \
--fail-with-body \
--upload-file "ethercat-${CI_COMMIT_TAG}.tar.bz2" \
"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.bz2"
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"ethercat.tar.bz2\",\"url\":\"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.bz2\",\"link_type\":\"package\",\"filepath\":\"/dist-tarballs/ethercat.tar.bz2\"}" \
--assets-link "{\"name\":\"ethercat.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/ethercat-${CI_COMMIT_TAG}.tar.gz\",\"link_type\":\"package\",\"filepath\":\"/dist-tarballs/ethercat.tar.gz\"}"
# from 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml', but on all branches
workflow:
rules: