From 4daeda146fe13b2e880063221af2309b949edcc3 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Tue, 19 Mar 2024 16:23:31 +0000 Subject: [PATCH] feat: allow devs to publish images from branches --- .github/workflows/release-ghcr-image.yaml | 45 +++++++++++++++++++ ...ocker.yaml => release-official-image.yaml} | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-ghcr-image.yaml rename .github/workflows/{release-docker.yaml => release-official-image.yaml} (97%) diff --git a/.github/workflows/release-ghcr-image.yaml b/.github/workflows/release-ghcr-image.yaml new file mode 100644 index 000000000..5ea46fc55 --- /dev/null +++ b/.github/workflows/release-ghcr-image.yaml @@ -0,0 +1,45 @@ +name: Create ghcr.io Docker image + +# Images are published manually +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag for the image' + required: false + default: ${{ github.sha }} + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@5 + with: + context: . + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }} diff --git a/.github/workflows/release-docker.yaml b/.github/workflows/release-official-image.yaml similarity index 97% rename from .github/workflows/release-docker.yaml rename to .github/workflows/release-official-image.yaml index 713e54e46..8cdc780e9 100644 --- a/.github/workflows/release-docker.yaml +++ b/.github/workflows/release-official-image.yaml @@ -32,7 +32,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }}