diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6424108 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,35 @@ +stages: + - prepare + - release + +prepare_job: + stage: prepare + image: alpine:latest + rules: + - if: '$CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+$/' + script: + - apk add curl jq + - 'curl -H "PRIVATE-TOKEN: $CI_API_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/changelog?version=$CI_COMMIT_TAG" | jq -r .notes > release_notes.md' + artifacts: + paths: + - release_notes.md + +release_job: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: prepare_job + artifacts: true + rules: + - if: '$CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+$/' + script: + - echo "Creating release" + release: + name: 'Release $CI_COMMIT_TAG' + description: release_notes.md + tag_name: '$CI_COMMIT_TAG' + ref: '$CI_COMMIT_SHA' + assets: + links: + - name: 'Container Image $CI_COMMIT_TAG' + url: "https://$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA" \ No newline at end of file