diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..e444d1b --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,26 @@ +name: Build and Test + +on: + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 + - name: Remove default github maven configuration + run: rm ~/.m2/settings.xml + - name: Run build with Gradle Wrapper + run: ./gradlew build diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index df85d31..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,53 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - -name: Build and Test - -on: - push: - branches: [ "main" ] - pull_request: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Setup Gradle - uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 - - name: Remove default github maven configuration - run: rm ~/.m2/settings.xml - - name: Run build with Gradle Wrapper - run: ./gradlew build - - name: Log in to Docker Hub - uses: docker/login-action@v3.0.0 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5.3.0 - with: - images: malla/configs-operator - - name: Build and push Docker image - uses: docker/build-push-action@v5.1.0 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release-operator.yaml b/.github/workflows/release-operator.yaml new file mode 100644 index 0000000..2b7293b --- /dev/null +++ b/.github/workflows/release-operator.yaml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + branches: [ "main" ] + tags: + - 'v*' + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 + - name: Remove default github maven configuration + run: rm ~/.m2/settings.xml + - name: Run build with Gradle Wrapper + run: ./gradlew build + - name: Log in to Docker Hub + uses: docker/login-action@v3.0.0 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5.3.0 + with: + images: malla/configs-operator + - name: Build and push Docker image + uses: docker/build-push-action@v5.1.0 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}