From aae85ecf94176722ce19c3aaf805e039f2c2183b Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Fri, 31 Jan 2025 01:31:09 -0300 Subject: [PATCH] ci: allow for manual custom docker release --- .github/workflows/release.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0221d3..cda6fd5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,20 @@ name: Release Pipeline on: release: - types: [created] + types: [ created ] push: branches: [ main ] + workflow_dispatch: + inputs: + tag: + description: 'Custom tag name for the image' + required: true + type: string + ref: + description: 'Git ref to checkout (branch, tag, or SHA)' + required: true + default: 'main' + type: string env: IMAGE_NAME: wygiwyh @@ -18,6 +29,13 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + if: github.event_name == 'workflow_dispatch' + + - name: Checkout code (non-manual) + uses: actions/checkout@v4 + if: github.event_name != 'workflow_dispatch' - name: Log in to Docker Hub uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 @@ -58,3 +76,16 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max + + - name: Build and push custom image + if: github.event_name == 'workflow_dispatch' + uses: docker/build-push-action@v6 + with: + context: . + file: ./docker/prod/django/Dockerfile + push: true + provenance: false + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max