From 6f3720a4aedaf01274eb420219ed0b08a5c34a03 Mon Sep 17 00:00:00 2001 From: Timur Demin Date: Sun, 20 Mar 2022 00:03:33 +0500 Subject: [PATCH] Reorganize GHCR workflows This removes the manual build workflow, unifying it with the automatic GHCR release workflow and ensuring Docker images are autobuilt. --- .github/workflows/docker-manual.yml | 34 ----------------------------- .github/workflows/docker.yml | 23 +++++++++++++++---- 2 files changed, 19 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/docker-manual.yml diff --git a/.github/workflows/docker-manual.yml b/.github/workflows/docker-manual.yml deleted file mode 100644 index 84bb51f..0000000 --- a/.github/workflows/docker-manual.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Push to GHCR (Manual) - -on: - workflow_dispatch: - inputs: - tag: - required: true - description: "Build specific tag" - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.inputs.tag }} - - name: Set up Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & push - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7b0d264..21cef48 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,16 +1,31 @@ name: Push to GHCR on: - release: - types: - - created + push: + tags: + - '*' + workflow_dispatch: + inputs: + tag: + required: true + description: "Build specific tag" jobs: docker: runs-on: ubuntu-latest steps: + - name: Set tag name from manual dispatch + if: ${{ github.event_name == "workflow_dispatch" }} + run: | + echo "tag_name=${{ github.event.inputs.tag }}" >> $GITHUB_ENV + - name: Set tag name from Git + if: ${{ github.event_name == "push" }} + run: | + echo "tag_name=${{ github.ref_name }}" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v2 + with: + ref: ${{ env.tag_name }} - name: Set up Buildx uses: docker/setup-buildx-action@v1 - name: Login to registry @@ -27,4 +42,4 @@ jobs: push: true tags: | ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} + ghcr.io/${{ github.repository }}:${{ env.tag_name }}