From 87bad9f28eac63017c4ced4fccc35b75f23abda4 Mon Sep 17 00:00:00 2001 From: shokakucarrier Date: Tue, 16 Apr 2024 14:29:26 +0800 Subject: [PATCH 1/2] add github actions file --- .github/workflows/service-build.yml | 92 +++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/service-build.yml diff --git a/.github/workflows/service-build.yml b/.github/workflows/service-build.yml new file mode 100644 index 0000000..7ad3768 --- /dev/null +++ b/.github/workflows/service-build.yml @@ -0,0 +1,92 @@ +name: build on maven + +on: + watch: + types: [started] + pull_request: + types: [opened, reopened, edited, synchronize, ready_for_review] + push: + branches: + - main + - master + - 1.1.x + - '**' + + workflow_dispatch: + +jobs: + verify: + name: verify with maven + runs-on: ubuntu-latest + env: + MAVEN_OPTS: "-Xmx4096m -Xms2048m -XX:MaxMetaspaceSize=4096m -Xss8m" + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 11 for x64 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + architecture: x64 + java-version: | + 11 + + - uses: s4u/maven-settings-action@v2.8.0 + with: + sonatypeSnapshots: true + + - name: Build the serivce verify phase + run: mvn -B -V clean verify -Prun-its + + build: + name: Build and push + runs-on: ubuntu-latest + needs: verify + if: ${{ github.event_name == 'push' }} + env: + MAVEN_OPTS: "-Xmx4096m -Xms2048m -XX:MaxMetaspaceSize=4096m -Xss8m" + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 11 for x64 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + architecture: x64 + java-version: | + 11 + + - name: Checkout tools repo + uses: actions/checkout@v4 + with: + repository: shokakucarrier/commonjava-images + path: commonjava-images + + - name: Log in to Quay.io + uses: redhat-actions/podman-login@v1 + with: + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_ROBOT_TOKEN }} + registry: quay.io + + - name: Buildah build + id: buildah-build + uses: redhat-actions/buildah-build@v2 + with: + image: indy + tags: latest-${{ github.ref_name }} + platforms: linux/amd64 + containerfiles: | + commonjava-images/indy-archive-service/multistage.Dockerfile + context: commonjava-images/indy-archive-service/ + build-args: | + GIT_URL=https://github.com/${{ github.repository }} + GIT_REVISION=${{ github.ref }} + + - name: Push To quay.io + id: push-to-quay + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.buildah-build.outputs.image }} + tags: ${{ steps.buildah-build.outputs.tags }} + registry: quay.io/factory2 From 425c3c7c39478cff898be7027581f94aaeff351e Mon Sep 17 00:00:00 2001 From: shokakucarrier Date: Tue, 16 Apr 2024 17:56:13 +0800 Subject: [PATCH 2/2] use correct arguments --- .github/workflows/service-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/service-build.yml b/.github/workflows/service-build.yml index 7ad3768..ba3de74 100644 --- a/.github/workflows/service-build.yml +++ b/.github/workflows/service-build.yml @@ -59,7 +59,7 @@ jobs: - name: Checkout tools repo uses: actions/checkout@v4 with: - repository: shokakucarrier/commonjava-images + repository: commonjava/commonjava-images path: commonjava-images - name: Log in to Quay.io @@ -73,11 +73,11 @@ jobs: id: buildah-build uses: redhat-actions/buildah-build@v2 with: - image: indy - tags: latest-${{ github.ref_name }} + image: indy-archive-service + tags: ${{ github.ref_name }} platforms: linux/amd64 containerfiles: | - commonjava-images/indy-archive-service/multistage.Dockerfile + commonjava-images/indy-archive-service/actions.Dockerfile context: commonjava-images/indy-archive-service/ build-args: | GIT_URL=https://github.com/${{ github.repository }}