prepare release
This commit is contained in:
parent
9d45731246
commit
fcfcd4b79d
4 changed files with 165 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -46,7 +46,8 @@ infrastructure/backup/.pybuilder
|
|||
# Include Git & CI workflow
|
||||
!.gitattributes
|
||||
!.gitignore
|
||||
!.github/
|
||||
!.gitlab-ci.yml
|
||||
!build.py
|
||||
|
||||
# ------------------------
|
||||
# Include ClojureScript Figwheel
|
||||
|
|
61
.gitlab-ci.yml
Normal file
61
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,61 @@
|
|||
stages:
|
||||
- build_and_test
|
||||
- package
|
||||
- upload
|
||||
- image
|
||||
|
||||
.img: &img
|
||||
image: "domaindrivenarchitecture/ddadevops-dind:4.13.0"
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||
- export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER
|
||||
- export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD
|
||||
- export IMAGE_TAG=$CI_COMMIT_TAG
|
||||
|
||||
.clj-job: &clj
|
||||
image: "domaindrivenarchitecture/ddadevops-clj:4.13.0"
|
||||
cache:
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
paths:
|
||||
- .m2
|
||||
before_script:
|
||||
- export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW
|
||||
- mkdir -p /root/.lein
|
||||
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_TOKEN_DOMAINDRIVENARCHITECTURE}\" }}}}" > ~/.lein/profiles.clj
|
||||
|
||||
.tag_only: &tag_only
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
when: never
|
||||
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||
|
||||
test:
|
||||
<<: *clj
|
||||
stage: build_and_test
|
||||
script:
|
||||
- pyb test
|
||||
|
||||
package-jar:
|
||||
<<: *clj
|
||||
stage: package
|
||||
script:
|
||||
- pyb package_jar
|
||||
artifacts:
|
||||
paths:
|
||||
- target/org.domaindrivenarchitecture
|
||||
|
||||
release-to-clojars:
|
||||
<<: *clj
|
||||
<<: *tag_only
|
||||
stage: upload
|
||||
script:
|
||||
- pyb upload_clj
|
||||
|
||||
dda-backup-image-publish:
|
||||
<<: *img
|
||||
<<: *tag_only
|
||||
stage: image
|
||||
script:
|
||||
- cd infrastructure/backup && pyb image test publish
|
101
build.py
Normal file
101
build.py
Normal file
|
@ -0,0 +1,101 @@
|
|||
from os import environ
|
||||
from subprocess import run
|
||||
from pybuilder.core import init, task
|
||||
from ddadevops import *
|
||||
|
||||
default_task = "dev"
|
||||
name = "dda-backup"
|
||||
MODULE = "not-used"
|
||||
PROJECT_ROOT_PATH = "."
|
||||
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on("ddadevops>=4.7.0")
|
||||
|
||||
input = {
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"stage": "notused",
|
||||
"project_root_path": PROJECT_ROOT_PATH,
|
||||
"build_types": [],
|
||||
"mixin_types": ["RELEASE"],
|
||||
"release_primary_build_file": "deps.edn",
|
||||
"release_secondary_build_files": [
|
||||
"infrastructure/backup/build.py",
|
||||
],
|
||||
"release_artifact_server_url": "https://repo.prod.meissa.de",
|
||||
"release_organisation": "meissa",
|
||||
"release_repository_name": name,
|
||||
"release_artifacts": [],
|
||||
}
|
||||
|
||||
build = ReleaseMixin(project, input)
|
||||
build.initialize_build_dir()
|
||||
|
||||
|
||||
@task
|
||||
def test_clj(project):
|
||||
run("make test", shell=True, check=True)
|
||||
|
||||
|
||||
@task
|
||||
def package_jar(project):
|
||||
run("make build-jar", shell=True, check=True)
|
||||
|
||||
|
||||
@task
|
||||
def upload_clj(project):
|
||||
run("make deploy", shell=True, check=True)
|
||||
|
||||
|
||||
@task
|
||||
def patch(project):
|
||||
linttest(project, "PATCH")
|
||||
release(project)
|
||||
|
||||
|
||||
@task
|
||||
def minor(project):
|
||||
linttest(project, "MINOR")
|
||||
release(project)
|
||||
|
||||
|
||||
@task
|
||||
def major(project):
|
||||
linttest(project, "MAJOR")
|
||||
release(project)
|
||||
|
||||
|
||||
@task
|
||||
def dev(project):
|
||||
linttest(project, "NONE")
|
||||
|
||||
|
||||
@task
|
||||
def prepare(project):
|
||||
build = get_devops_build(project)
|
||||
build.prepare_release()
|
||||
|
||||
|
||||
@task
|
||||
def tag(project):
|
||||
build = get_devops_build(project)
|
||||
build.tag_bump_and_push_release()
|
||||
|
||||
|
||||
@task
|
||||
def publish_artifacts(project):
|
||||
build = get_devops_build(project)
|
||||
build.publish_artifacts()
|
||||
|
||||
|
||||
def release(project):
|
||||
prepare(project)
|
||||
tag(project)
|
||||
|
||||
|
||||
def linttest(project, release_type):
|
||||
build = get_devops_build(project)
|
||||
build.update_release_type(release_type)
|
||||
test(project)
|
2
deps.edn
2
deps.edn
|
@ -1,5 +1,5 @@
|
|||
{:project {:name org.domaindrivenarchitecture/dda-backup
|
||||
:version "0.1.1-SNAPSHOT"}
|
||||
:version "5.0.0-SNAPSHOT"}
|
||||
|
||||
;; ---------------------------------------------------------
|
||||
:paths
|
||||
|
|
Loading…
Reference in a new issue