From f3838ccc81f76846b37059aa704f8d7df7e4fb84 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Wed, 2 Jul 2025 11:04:39 +0200 Subject: [PATCH] LCORE-311: GH actions release image building from tag --- .github/workflows/build_and_push_release.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/build_and_push_release.yaml diff --git a/.github/workflows/build_and_push_release.yaml b/.github/workflows/build_and_push_release.yaml new file mode 100644 index 000000000..2af174277 --- /dev/null +++ b/.github/workflows/build_and_push_release.yaml @@ -0,0 +1,47 @@ +name: Build image from a tag and push it to Quay.io + +on: + push: + tags: + - '*' # Trigger for all tags + +env: + IMAGE_NAME: lightspeed-stack + IMAGE_NAMESPACE: lightspeed-core + REGISTRY: quay.io + GIT_TAG: ${{ github.ref_name }} + LATEST_TAG: latest + CONTAINER_FILE: Containerfile + +jobs: + build-and-push-release: + runs-on: ubuntu-latest + permissions: + contents: read + # Required for image pushing to a registry + packages: write + steps: + - name: Install buildah + run: | + sudo apt update + sudo apt install -y buildah + - name: Checkout code + uses: actions/checkout@v4 + - name: Build image with Buildah + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_NAME }} + tags: | + ${{ env.GIT_TAG }} + ${{ env.LATEST_TAG }} + containerfiles: | + ${{ env.CONTAINER_FILE }} + oci: true + - name: Push image to Quay.io + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }} + username: ${{ secrets.QUAY_REGISTRY_USERNAME }} + password: ${{ secrets.QUAY_REGISTRY_PASSWORD }}