From 82046497d2fe8d6cde65307e2567c2e1fb72fbef Mon Sep 17 00:00:00 2001 From: Christian Ingenhaag Date: Sat, 23 Mar 2024 11:05:25 +0100 Subject: [PATCH] chore: Integrate release process --- .github/workflows/gradle-build-branches.yml | 23 +++++++++++++++++++++ .github/workflows/gradle-build.yml | 17 +++++++++++++-- build.gradle | 12 +++++------ 3 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/gradle-build-branches.yml diff --git a/.github/workflows/gradle-build-branches.yml b/.github/workflows/gradle-build-branches.yml new file mode 100644 index 00000000..83500239 --- /dev/null +++ b/.github/workflows/gradle-build-branches.yml @@ -0,0 +1,23 @@ +name: Build + +on: + push: + branches-ignore: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Set up JDK 21 for x64 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + architecture: x64 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index 8756b6c3..40e2179c 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -1,7 +1,13 @@ name: Build on: - - push + push: + branches: + - main + +permissions: + packages: write + contents: write jobs: build: @@ -17,5 +23,12 @@ jobs: architecture: x64 - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 + - name: Setup git config + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" - name: Build with Gradle - run: ./gradlew build \ No newline at end of file + env: + GH_TOKEN: '${{secrets.GITHUB_TOKEN}}' + GH_BRANCH: '${{github.ref.name}}' + run: ./gradlew release -Prelease.useAutomaticVersion=true --stacktrace \ No newline at end of file diff --git a/build.gradle b/build.gradle index 609aac13..5c2fcda5 100644 --- a/build.gradle +++ b/build.gradle @@ -39,14 +39,13 @@ tasks.named('test') { } bootBuildImage { - imageName = "registry.gitlab.com/cin/${project.name}:${project.version}" - tags = ["registry.gitlab.com/cin/${project.name}:${System.getenv("CI_COMMIT_BRANCH")}"] + imageName = "ghcr.io/chrisingenhaag/${project.name}:${project.version}" + tags = ["ghcr.io/chrisingenhaag/${project.name}:${System.getenv("GH_BRANCH")}"] publish = !project.version.contains("-SNAPSHOT") docker { publishRegistry { - url = System.getenv("CI_REGISTRY") ?: "n/a" - username = System.getenv("CI_REGISTRY_USER") ?: "n/a" - password = System.getenv("CI_REGISTRY_PASSWORD") ?: "n/a" + url = "https://ghcr.io" + token = System.getenv("GH_TOKEN") ?: "n/a" } } } @@ -56,11 +55,10 @@ release { git { requireBranch.set('main') pushOptions.add("-o ci.skip") + preCommitText = "[ci skip]" } } - - test { finalizedBy jacocoTestReport, jacocoTestCoverageVerification }