Loading .gitlab-ci.yml +8 −3 Original line number Diff line number Diff line Loading @@ -42,20 +42,25 @@ pages: rules: - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # See https://gitlab.com/gitlab-org/release-cli/-/blob/master/docs/index.md#usage release: image: dwdraju/alpine-curl-jq image: registry.gitlab.com/gitlab-org/release-cli:v0.1.0 stage: deployment variables: script: - apk add --no-cache curl jq - for JOB in jobs/*; do - JOB=$(basename ${JOB}) - for VERSION in jobs/${JOB}/versions/*; do - VERSION=$(basename ${VERSION} .md) - if [[ ! $(curl -s -D "/dev/null" https://gitlab.com/api/v4/projects/go2scale%2Fhub/releases/${JOB}-${VERSION} | jq -r ".message") =~ "null" ]]; then - echo "no release for version ${VERSION}" - release-cli create --name ${JOB}-${VERSION} --description $(cat jobs/${JOB}/versions/${VERSION}.md) --tag-name ${JOB}-${VERSION} --ref ${CI_COMMIT_SHA} --assets-link "{\"name\":\"Hub url\",\"url\":\"https://jobs.go2scale.io/${VERSION}/${JOB}.yml\",\"link_type\":\"other\",\"filepath\":\"jobs/${JOB}/${JOB}.yml\"}" - else - echo "release ${VERSION} exists" - fi - done - done rules: - if: $CI_COMMIT_TAG when: never Loading
.gitlab-ci.yml +8 −3 Original line number Diff line number Diff line Loading @@ -42,20 +42,25 @@ pages: rules: - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' # See https://gitlab.com/gitlab-org/release-cli/-/blob/master/docs/index.md#usage release: image: dwdraju/alpine-curl-jq image: registry.gitlab.com/gitlab-org/release-cli:v0.1.0 stage: deployment variables: script: - apk add --no-cache curl jq - for JOB in jobs/*; do - JOB=$(basename ${JOB}) - for VERSION in jobs/${JOB}/versions/*; do - VERSION=$(basename ${VERSION} .md) - if [[ ! $(curl -s -D "/dev/null" https://gitlab.com/api/v4/projects/go2scale%2Fhub/releases/${JOB}-${VERSION} | jq -r ".message") =~ "null" ]]; then - echo "no release for version ${VERSION}" - release-cli create --name ${JOB}-${VERSION} --description $(cat jobs/${JOB}/versions/${VERSION}.md) --tag-name ${JOB}-${VERSION} --ref ${CI_COMMIT_SHA} --assets-link "{\"name\":\"Hub url\",\"url\":\"https://jobs.go2scale.io/${VERSION}/${JOB}.yml\",\"link_type\":\"other\",\"filepath\":\"jobs/${JOB}/${JOB}.yml\"}" - else - echo "release ${VERSION} exists" - fi - done - done rules: - if: $CI_COMMIT_TAG when: never