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 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/ci.yml (limited to '.github/workflows/ci.yml') 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 -- cgit v1.2.3