From afecf5534ab031f294274116a6297fbed10017b9 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 28 Nov 2025 12:27:19 +0100 Subject: build: update ci (#201) --- .github/workflows/ci.yml | 77 +++++++++++++++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 35 -------------------- .github/workflows/release.yml | 27 +++++++++++++++ .github/workflows/test.yml | 72 ---------------------------------------- .release-please-manifest.json | 3 ++ build.gradle.kts | 2 +- release-please-config.json | 18 ++++++++++ 7 files changed, 126 insertions(+), 108 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/test.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..170f5dc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'master' ] + release: + types: [ 'created' ] + +permissions: + contents: read + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Execute tests + run: ./gradlew test + integrationTests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Execute integration tests + run: ./gradlew integrationTest + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: + - tests + - integrationTests + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + # Setup and build docker image + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build image + run: ./gradlew bootBuildImage + # Deploy docker image + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Deploy release image + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + run: | + docker tag ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}:${{ github.ref_name }} + docker push ghcr.io/${{ github.repository }} + docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} + - name: Deploy preview image + if: ${{ github.ref == 'refs/heads/master' }} + run: | + docker tag ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}:preview + docker push ghcr.io/${{ github.repository }}:preview \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 65b5e78..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 'Run build and deploy' - -on: - release: - types: [ 'published' ] - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Execute image build and push - run: | - ./gradlew bootBuildImage - docker tag ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}:${{ github.ref_name }} - docker push ghcr.io/${{ github.repository }} - docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c89694b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: release-please + +on: + push: + branches: [ 'master' ] + +permissions: + contents: read + +jobs: + release-please: + name: run release-please + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + + - uses: googleapis/release-please-action@v4 + with: + token: ${{ steps.app-token.outputs.token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 37ad568..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: 'Run Tests' - -on: - push: - branches: [ 'master' ] - tags: [ '*' ] - pull_request: - branches: [ '*' ] - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Execute tests - run: ./gradlew test - - integrationTests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Execute integration tests - run: ./gradlew integrationTest - - # Deploy preview build for testing based on latest successful tested master - deployPreview: - runs-on: ubuntu-latest - needs: - - tests - - integrationTests - if: github.ref == 'refs/heads/master' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Execute image build and push - run: | - ./gradlew bootBuildImage - docker tag ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}:preview - docker push ghcr.io/${{ github.repository }}:preview \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..9d5158b --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.12.1" +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7e5acaa..befc0db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ plugins { } group = "dev.dnpm" -version = "0.13.0-SNAPSHOT" +version = "0.13.0-SNAPSHOT" // x-release-please-version var versions = mapOf( "mtb-dto" to "0.1.1", diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..a6b3131 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/refs/heads/main/schemas/config.json", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "include-v-in-tag": true, + "include-component-in-tag": false, + "release-type": "simple", + "packages": { + ".": { + "extra-files": [ + { + "type": "generic", + "path": "build.gradle.kts" + } + ] + } + } +} \ No newline at end of file -- cgit v1.2.3