Skip to content

Commit

Permalink
[docker][chore] Backport workflow_dispatch logic to single image
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche committed Nov 17, 2022
1 parent 2173083 commit 02bf0f2
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ jobs:

steps:
- name: Check out repository
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v2

- name: Set build platforms
if: github.event_name != 'workflow_dispatch'
id: platform
run: |
GITHUB_REF="${{ github.ref }}"
Expand All @@ -41,6 +43,7 @@ jobs:
fi
- name: Docker meta
if: github.event_name != 'workflow_dispatch'
id: meta
uses: docker/metadata-action@v3
with:
Expand All @@ -61,17 +64,10 @@ jobs:
org.opencontainers.image.vendor=Some Engineering Inc.
- name: Set up Docker Buildx
if: github.event_name != 'workflow_dispatch'
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ secrets.CACHE_VERSION }}-buildx-
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
Expand All @@ -80,14 +76,15 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
if: github.event_name != 'workflow_dispatch'
uses: docker/build-push-action@v2
with:
context: .
Expand All @@ -100,13 +97,6 @@ jobs:
TESTS=false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

split-build:
name: Build split Docker images
Expand Down

0 comments on commit 02bf0f2

Please sign in to comment.