diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 000000000..385f5ddd2 --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,16 @@ +{{ range .Versions }} + +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }} +{{ range .CommitGroups -}} +### {{ .Title }} +{{ range .Commits -}} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} +{{ end }} +{{ end -}} +{{ end -}} + +{{ range .Versions -}} +{{ if .Tag.Previous -}} +[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }} +{{ end -}} +{{ end -}} diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100644 index 000000000..357d2ceed --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,39 @@ +style: gitlab +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://git.gfz-potsdam.de/sec34/port +options: + commits: + filters: + Type: + - feat + - fix + - perf + - refactor + - data + - build + - util + - doc + - chore + - ci + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + data: Simulation Input + build: Build System + util: Evaluation Scripts + doc: Documentation + chore: Householding and Cleanup + ci: CI + header: + pattern: "^(\\w*)\\:\\s(.*)$" + pattern_maps: + - Type + - Subject + notes: + keywords: + - BREAKING CHANGE diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cfa0e42da..749e3e6f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,9 +20,12 @@ image: git.gfz-potsdam.de:5000/sec34/port:builder stages: # List of stages for jobs, and their order of execution - build + - release variables: GIT_SUBMODULE_STRATEGY: recursive + SOURCE_ARCHIVE_NAME: 'port_${CI_COMMIT_TAG}_sources.tar.gz' + CHANGELOG_FILE: 'commit_changelog.md' build-poet: # This job runs in the build stage, which runs first. stage: build @@ -30,3 +33,55 @@ build-poet: # This job runs in the build stage, which runs first. - mkdir build && cd build - cmake .. - make -j$(nproc) + +archive-sources: # This job runs in the build stage, which runs first. + image: python:3 + stage: release + + before_script: + - pip install git-archive-all + - echo ARCHIVE_JOB_ID=${CI_JOB_ID} >> archives.env + script: + - git-archive-all ${SOURCE_ARCHIVE_NAME} + artifacts: + paths: + - ${SOURCE_ARCHIVE_NAME} + reports: + dotenv: archives.env + rules: + - if: $CI_COMMIT_TAG + +release-description: + image: golang:bullseye + stage: release + rules: + - if: $CI_COMMIT_TAG + before_script: + - go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.2 + script: + - git-chglog -o ${CHANGELOG_FILE} ${CI_COMMIT_TAG} + artifacts: + paths: + - ${CHANGELOG_FILE} + + +release-create: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + rules: + - if: $CI_COMMIT_TAG + script: + - echo "Running release job" + needs: + - job: archive-sources + artifacts: true + - job: release-description + artifacts: true + release: + tag_name: $CI_COMMIT_TAG + name: 'PORT $CI_COMMIT_TAG' + description: ${CHANGELOG_FILE} + assets: + links: + - name: '${SOURCE_ARCHIVE_NAME}' + url: 'https://git.gfz-potsdam.de/sec34/port/-/jobs/${ARCHIVE_JOB_ID}/artifacts/file/${SOURCE_ARCHIVE_NAME}'