From 882d136e5c7f385d29e49be07cb5dee9321c185d Mon Sep 17 00:00:00 2001 From: rigazilla Date: Wed, 3 Jul 2024 18:17:34 +0200 Subject: [PATCH] ci release --- .../workflows/on_call_do_publish_image.yml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/on_call_do_publish_image.yml diff --git a/.github/workflows/on_call_do_publish_image.yml b/.github/workflows/on_call_do_publish_image.yml new file mode 100644 index 0000000..71ca1d0 --- /dev/null +++ b/.github/workflows/on_call_do_publish_image.yml @@ -0,0 +1,115 @@ +name: CI Release Images + +on: + workflow_call: + inputs: + repository: + description: 'Name of the repo to download server artifact from' + type: string + run-id: + description: 'Id of the run to download server artifact from' + type: string + art-name: + description: 'Artifact name to download' + type: string + tags: + description: 'Tags for the image' + type: string + push: + description: 'If true push image.' + default: true + type: boolean + + branch: + description: 'infinispan-image branch to checkout.' + default: main + type: string + secrets: + token: + required: true + description: 'GH token' + quay_user: + required: true + quay_pass: + required: true + workflow_dispatch: + inputs: + repository: + description: 'Name of the repo to download server artifact from' + type: string + run-id: + description: 'Id of the run to download server artifact from' + type: string + art-name: + description: 'Artifact name to download' + type: string + tags: + description: 'Tags for the image' + type: string + push: + description: 'If true push image.' + default: true + type: boolean + branch: + description: 'infinispan-image branch to checkout.' + default: main + type: string + +jobs: + image: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + repository: 'infinispan/infinispan-images' + ref: ${{ inputs.branch }} + + - name: Download Artifact + uses: actions/download-artifact@v4.1.7 + with: + repository: '${{ inputs.repository }}' + run-id: '${{ inputs.run-id }}' + name: '${{ inputs.art-name }}' + github-token: ${{ secrets.token }} + + - name: Unzip Artifact + id: unzip_artifact + run: | + echo "serverzip=$(ls infinispan-server-*.zip)" >> $GITHUB_OUTPUT + - name: Install CEKit + uses: cekit/actions-setup-cekit@v1.1.5 + + - name: Create Dockerfile + env: + SERVER_ZIP: ${{ steps.unzip_artifact.outputs.serverzip }} + TAGS: ${{ inputs.tags }} + run: | + pwd + ls + SERVER_OVERRIDE="{\"artifacts\":[{\"name\":\"server\",\"path\":\"${GITHUB_WORKSPACE}/${SERVER_ZIP}\"}]}" + TAG="${TAGS%%,*}" + IMG_NAME="${TAG%%:*}" + IMG_VER="${TAG##*:}" + cekit -v --descriptor server-openjdk.yaml build --overrides '{"version": "'${IMG_VER}'", "name": "'${IMG_NAME}'"}' --overrides ${SERVER_OVERRIDE} --dry-run docker + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Quay + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.quay_user }} + password: ${{ secrets.quay_pass }} + + - name: Build + uses: docker/build-push-action@v3 + with: + context: ./target/image + platforms: linux/amd64 + pull: true + push: ${{ inputs.push }} + file: target/image/Dockerfile + tags: ${{ inputs.tags }} + load: true