diff --git a/.ci/extractVersionChanges.sh b/.ci/extractVersionChanges.sh deleted file mode 100755 index c36a2cf..0000000 --- a/.ci/extractVersionChanges.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# based on https://stackoverflow.com/questions/40450238/parse-a-changelog-and-extract-changes-for-a-version -# -# works with changelogs in the format of https://keepachangelog.com -# -# usage: ./extractVersionChanges.sh "1.0.1" ./CHANGELOG.md ./CHANGELOG-CHANGES.md -# -awk -v ver="$1" ' - /^#+ \[/ { if (p) { exit }; if ($2 == "["ver"]") { p=1; next} } p && NF - ' "$2" >"$3" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a1613f..8d2f33b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ include: - project: 'buildsrv/ci' file: - '/templates/build/docker-dind-multiarch/v1.gitlab-ci.yml' + - '/templates/build/gitlab-release/v1.gitlab-ci.yml' - '/templates/build/registry-image-copy/v1.gitlab-ci.yml' .go-cache: @@ -24,6 +25,10 @@ include: # don't run on tags if: '$CI_COMMIT_TAG == null' +.rule-run-on-tags: &rule-run-on-tags + if: $CI_COMMIT_TAG + when: on_success + default: image: golang:1.20 @@ -105,18 +110,16 @@ build: script: - make -.template_build_and_push_image: +build-docker: # per includes extends: .build:docker-dind-multiarch - variables: - APP_VERSION: $APP_VERSION_INTERNAL - retry: 2 - -build-docker: stage: build - extends: .template_build_and_push_image rules: - *rule-build-docker + - *rule-run-on-tags + variables: + APP_VERSION: $APP_VERSION_INTERNAL + retry: 2 # integration below -------------------- @@ -180,51 +183,31 @@ test-image: # release below ------------------------ -extract-version-changes: - stage: prepare - rules: - - if: $CI_COMMIT_TAG - when: on_success - script: - - /bin/bash ./.ci/extractVersionChanges.sh "$CI_COMMIT_TAG" ./CHANGELOG.md ./CHANGELOG-CHANGES.md - artifacts: - paths: - - CHANGELOG-CHANGES.md - -release: - # the release job creates a gitlab release +gitlab-release: + # per includes + extends: .build:gitlab-release stage: release - image: registry.gitlab.com/gitlab-org/release-cli:v0.15.0 - dependencies: - - extract-version-changes - # We recommend the use of `rules` to prevent these pipelines - # from running. See the notes section below for details. rules: - - if: $CI_COMMIT_TAG - when: on_success - script: - - echo "running release job for $TAG" - release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties - tag_name: '$CI_COMMIT_TAG' # use the git tag as gitlab release name - description: './CHANGELOG-CHANGES.md' - ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA. + - *rule-run-on-tags tag-release: + # per includes + extends: .build:registry-image-copy stage: release - extends: .template_build_and_push_image rules: - - if: $CI_COMMIT_TAG - when: on_success + - *rule-run-on-tags + needs: + - job: build-docker variables: - APP_VERSION: $CI_COMMIT_TAG + IN_DOCKER_IMAGE_TAG: "$APP_VERSION_INTERNAL" + OUT_DOCKER_IMAGE_TAG: "$CI_COMMIT_TAG" publish-docker-hub: # per includes stage: release extends: .build:registry-image-copy rules: - - if: $CI_COMMIT_TAG - when: on_success + - *rule-run-on-tags needs: - tag-release variables: