Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .gitlab-ci-scripts/goreleaser.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

mkdir ../shared
first=$(grep '^## ' -nm1 CHANGELOG.md | cut -d':' -f1); \
second=$(grep '^## ' -nm2 CHANGELOG.md | tail -n1 | cut -d':' -f1); \
Expand All @@ -6,5 +8,13 @@ GORELEASER_CONFIG=".goreleaser.yml"
if [ -n "$CI_COMMIT_TAG" ] && echo "$CI_COMMIT_TAG" | grep -qv '~'; then
GORELEASER_CONFIG=".goreleaser-release.yml"
fi
goreleaser release -f $GORELEASER_CONFIG --release-notes ../shared/release.md
GORELEASER_OPTIONS=""
[[ "${CI_COMMIT_BRANCH}" != "${CI_DEFAULT_BRANCH}" ]] && {
[[ "${CI_COMMIT_BRANCH}" != "${PREREL_BRANCH_NAME}" ]] && {
# we're on devel
GORELEASER_OPTIONS="--skip docker"
}
}

goreleaser release -f $GORELEASER_CONFIG --release-notes ../shared/release.md --verbose ${GORELEASER_OPTIONS}
ls -l results
12 changes: 10 additions & 2 deletions .gitlab-ci-scripts/set-prerel-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

DEVSTRING="pr"
VERSION_FILE=internal/model/version/VERSION
Expand Down Expand Up @@ -38,9 +38,17 @@ for R in $REMOTES; do
MASTER_BRANCH="refs/remotes/${R}/${MASTER}"
#echo "Master-branch: ${MASTER_BRANCH}"
[ "x${R}" = "xorigin" ] && break
[ "x${R}" = "xcodebase" ] && break
done

PREREL=$(git rev-list --count HEAD ^"$MASTER_BRANCH")
[[ "${DEVSTRING}" == "dev" ]] && {
[[ -z ${CI_JOB_ID} ]] || {
PREREL=${CI_JOB_ID}
}
}
[[ -z ${PREREL} ]] && {
PREREL=$(git rev-list --count HEAD ^"$MASTER_BRANCH")
}

# use version file:
VERSION=$(cat "$VERSION_FILE")
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci-scripts/upload.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

REPO_TARGET="/prerel"
if [ -n "$CI_COMMIT_TAG" ] && echo "$CI_COMMIT_TAG" | grep -qv '~'; then
Expand Down
40 changes: 28 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
include:
- 'https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/-/raw/master/ci-include/github-status-sync.yml'
- "https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/raw/master/ci-include/pipeline-jobs-publish-to-repo.yml"


variables:
USE_GORELEASER: "true"
UPSTREAM_PROJECT: oidc-mytoken/server

image: golang:1.22
stages:
- build
- test
- lint
- release
- package
- publish
- deploy

default:
Expand Down Expand Up @@ -61,19 +65,17 @@ build_migratedb:
script:
- go build github.com/oidc-mytoken/server/cmd/mytoken-server/mytoken-migratedb

prerelease:
stage: release
package:
stage: package
image:
name: goreleaser/goreleaser
entrypoint: [ "" ]
services:
- docker:dind
only:
refs:
- tags
- prerel
tags:
- linux
# only:
# refs:
# - tags
# - prerel
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
Expand All @@ -83,9 +85,23 @@ prerelease:
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
script:
- if [ -z "$CI_COMMIT_TAG" ]; then .gitlab-ci-scripts/set-prerel-version.sh; fi;
- .gitlab-ci-scripts/goreleaser.sh
- .gitlab-ci-scripts/upload.sh
- |
[[ "$CI_COMMIT_TAG" == "${PREREL_BRANCH_NAME}" ]] && {
echo "Running set-prerel-version"
.gitlab-ci-scripts/set-prerel-version.sh
}
[[ "$CI_COMMIT_TAG" != "${PREREL_BRANCH_NAME}" ]] && {
[[ "$CI_COMMIT_TAG" != "${CI_DEFAULT_BRANCH}" ]] && {
# we're on a devel branch
echo "Running set-devel-version"
.gitlab-ci-scripts/set-prerel-version.sh --devstring dev
}
}
.gitlab-ci-scripts/goreleaser.sh

artifacts:
paths:
- "results/*"
after_script:
- curl -d "repo=github.com/oidc-mytoken/server" https://goreportcard.com/checks

Expand Down
Loading