ci: include pipeline from ci-templates
This commit is contained in:
+2
-49
@@ -1,59 +1,12 @@
|
|||||||
include:
|
include:
|
||||||
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
||||||
|
- project: unboundsoftware/ci-templates
|
||||||
|
file: Release.gitlab-ci.yml
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- prepare
|
|
||||||
- build
|
- build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- env | sort
|
- env | sort
|
||||||
|
|
||||||
changelog:
|
|
||||||
stage: prepare
|
|
||||||
image:
|
|
||||||
name: orhunp/git-cliff:latest
|
|
||||||
entrypoint: [ "" ]
|
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
|
|
||||||
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
|
|
||||||
script:
|
|
||||||
- 'git-cliff --bump --unreleased > CHANGES.md'
|
|
||||||
- 'git-cliff --bump > CHANGELOG.md'
|
|
||||||
- 'git-cliff --bumped-version 2>/dev/null > VERSION'
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- CHANGES.md
|
|
||||||
- CHANGELOG.md
|
|
||||||
- VERSION
|
|
||||||
rules:
|
|
||||||
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
|
|
||||||
|
|
||||||
handle_mr:
|
|
||||||
stage: prepare
|
|
||||||
image: alpine:latest
|
|
||||||
needs:
|
|
||||||
- changelog
|
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
|
|
||||||
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
|
|
||||||
before_script:
|
|
||||||
- 'apk add --no-cache jq curl'
|
|
||||||
script: |
|
|
||||||
echo "Project: ${CI_PROJECT_ID}"
|
|
||||||
echo "Token: ${CI_JOB_TOKEN}"
|
|
||||||
MRS=$(curl -s -H "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/merge_requests?state=opened&source_branch=next-release")
|
|
||||||
echo "${MRS}"
|
|
||||||
MR=$(echo "${MRS} | jq ".[].id")
|
|
||||||
if [ -n "${MR}" ]; then
|
|
||||||
curl -s -X POST -H "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/repository/branches?branch=next-release&ref=${CI_DEFAULT_BRANCH}"
|
|
||||||
fi
|
|
||||||
BODY="$(jq --null-input -c --arg title "ci: prepare release $(cat VERSION)" --arg content "$(cat CHANGES.md | base64 -w0)" '{"branch": "next-release", "author_email": "releaser@unbound.se", "author_name": "Releaser", "content": $content, "commit_message": $title, "encoding": "base64"}')"
|
|
||||||
curl -X PUT \
|
|
||||||
-H "JOB-TOKEN: $CI_JOB_TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
--data "${BODY}" \
|
|
||||||
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/repository/files/CHANGELOG%2Emd"
|
|
||||||
rules:
|
|
||||||
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
|
|
||||||
|
|||||||
Reference in New Issue
Block a user