public devops part
This commit is contained in:
parent
626cb4e4ac
commit
65d420d417
47
.gitea/workflows/build-java.yaml
Normal file
47
.gitea/workflows/build-java.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
#
|
||||
#
|
||||
# Build workflow for all modules of captica.expert
|
||||
#
|
||||
# Project: workflows
|
||||
# Author: Marc Böhm <marc.boehm@captica.de>
|
||||
# License: MIT License (see LICENSE.md)
|
||||
#
|
||||
# Copyright (c) captica GmbH est. 2021
|
||||
#
|
||||
name: Java build workflow for captica.expert modules
|
||||
on:
|
||||
workflow_call:
|
||||
jobs:
|
||||
build:
|
||||
name: Build java distribution
|
||||
runs-on: docker-ubuntu-nonroot
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GIT_ACCESS_TOKEN }}
|
||||
submodules: 'true'
|
||||
- name: Setup java runtime
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: '21'
|
||||
- name: Run gradle build process
|
||||
run: |
|
||||
./gradlew build
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifacts-build
|
||||
path: |
|
||||
build/libs/
|
||||
build/*.sh
|
||||
retention-days: 10
|
||||
- name: Upload test artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifacts-test
|
||||
path: |
|
||||
build/test-results
|
||||
build/reports
|
||||
retention-days: 10
|
||||
48
.gitea/workflows/publish-docker-springboot.yaml
Normal file
48
.gitea/workflows/publish-docker-springboot.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
#
|
||||
# Publish docker workflow for all modules of captica.expert
|
||||
#
|
||||
# Project: workflows
|
||||
# Author: Marc Böhm <marc.boehm@captica.de>
|
||||
# License: MIT License (see LICENSE.md)
|
||||
#
|
||||
# Copyright (c) captica GmbH est. 2021
|
||||
#
|
||||
name: Publish docker workflow for captica.expert modules
|
||||
on:
|
||||
workflow_call:
|
||||
jobs:
|
||||
publish_docker:
|
||||
name: Build and publish docker image
|
||||
runs-on: docker-ubuntu
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v4
|
||||
- name: Download build artifacts (dist files)
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: artifacts-build
|
||||
path: build/
|
||||
- name: Setup docker buildx environment
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to docker registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.CONTAINER_REGISTRY_URL }}
|
||||
username: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
|
||||
- name: Setup environment variables from "build/env-setup.sh"
|
||||
run: |
|
||||
source build/env-setup.sh
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: "${{ vars.CONTAINER_REGISTRY_URL }}/${{gitea.repository}}:latest"
|
||||
build-args: |
|
||||
FILE_BINARY=${{ env.CAPTICA_APPLICATION_FILE_BINARY }}
|
||||
NAME_APPLICATION=${{ env.CAPTICA_APPLICATION_NAME }}
|
||||
PORT_EXPOSURE=${{ env.CAPTICA_APPLICATION_PORT }}
|
||||
JAVA_VERSION=${{ env.CAPTICA_APPLICATION_JAVA_VERSION }}
|
||||
74
gradle/build-version.gradle
Normal file
74
gradle/build-version.gradle
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Enables version handling on build process
|
||||
*
|
||||
* Project: gradle
|
||||
* Author: Marc Böhm <marc.boehm@captica.de>
|
||||
* License: MIT License (see LICENSE.md)
|
||||
*
|
||||
* Copyright (c) captica GmbH est. 2021
|
||||
*/
|
||||
|
||||
// Load external plugins
|
||||
buildscript {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'me.qoomon:gradle-git-versioning-plugin:6.4.3'
|
||||
}
|
||||
}
|
||||
|
||||
// Apply plugins
|
||||
apply plugin: me.qoomon.gradle.gitversioning.GitVersioningPlugin
|
||||
|
||||
// Setup versions handling
|
||||
gitVersioning.apply {
|
||||
refs {
|
||||
branch('(feature|bugfix)/(?<feature>.+)') {
|
||||
version = '${ref.feature}-SNAPSHOT'
|
||||
}
|
||||
branch('release/v(?<version>.*)') {
|
||||
version = '${ref.version}-RC'
|
||||
}
|
||||
branch('.+') {
|
||||
version = '${ref}-SNAPSHOT'
|
||||
}
|
||||
tag('v(?<version>.*)') {
|
||||
version = '${ref.version}'
|
||||
}
|
||||
}
|
||||
// optional fallback configuration in case of no matching ref configuration
|
||||
rev {
|
||||
version = '${commit}'
|
||||
}
|
||||
}
|
||||
|
||||
// Simple task to write the env shell script to register version env vars
|
||||
task writeVersionFile() {
|
||||
doLast {
|
||||
new File(buildDir, 'env-setup.sh').text = """
|
||||
#!/bin/sh
|
||||
|
||||
# Default env vars
|
||||
export CAPTICA_APPLICATION_VERSION=${version}
|
||||
export CAPTICA_APPLICATION_NAME=${project.name}
|
||||
export CAPTICA_APPLICATION_FILE_BINARY=${bootJar.archiveFileName.get()}
|
||||
export CAPTICA_APPLICATION_PORT=${applicationPort}
|
||||
export CAPTICA_APPLICATION_JAVA_VERSION=${java.sourceCompatibility}
|
||||
|
||||
# Gitea/Github specific env variables
|
||||
echo "CAPTICA_APPLICATION_VERSION=\$CAPTICA_APPLICATION_VERSION" >> \$GITHUB_ENV
|
||||
echo "CAPTICA_APPLICATION_FILE_BINARY=\$CAPTICA_APPLICATION_FILE_BINARY" >> \$GITHUB_ENV
|
||||
echo "CAPTICA_APPLICATION_NAME=\$CAPTICA_APPLICATION_NAME" >> \$GITHUB_ENV
|
||||
echo "CAPTICA_APPLICATION_PORT=\$CAPTICA_APPLICATION_PORT" >> \$GITHUB_ENV
|
||||
echo "CAPTICA_APPLICATION_JAVA_VERSION=\$CAPTICA_APPLICATION_JAVA_VERSION" >> \$GITHUB_ENV
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
// Link up version file task to bootJar
|
||||
tasks.named('bootJar').configure {
|
||||
dependsOn writeVersionFile
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user