From 27c6f9cbc298fb8bf578464e4c3f9f07402b87ab Mon Sep 17 00:00:00 2001 From: Skye Gill Date: Tue, 18 Oct 2022 12:06:24 +0100 Subject: [PATCH] fix: build and push to docker registry on tag creation (#121) Signed-off-by: Skye Gill Signed-off-by: Skye Gill --- .github/workflows/build-oci.yml | 54 ---------------------------- .github/workflows/release-please.yml | 48 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/build-oci.yml diff --git a/.github/workflows/build-oci.yml b/.github/workflows/build-oci.yml deleted file mode 100644 index 09766d018..000000000 --- a/.github/workflows/build-oci.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: ci - -on: - push: - tags: - - "v*.*.*" - branches: - - main - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@master - with: - platforms: all - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@master - - - name: Build - uses: docker/build-push-action@v2 - with: - builder: ${{ steps.buildx.outputs.name }} - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 0f4caab15..9839cb6c5 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -4,6 +4,11 @@ on: push: branches: - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: release-please: runs-on: ubuntu-latest @@ -48,3 +53,46 @@ jobs: config/webhook/certificate.yaml config/rendered/release.yaml config/samples/end-to-end.yaml + + build-oci: + needs: release-please + runs-on: ubuntu-latest + if: ${{ needs.release-please.outputs.release_created }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Build + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}