Skip to content

Commit 9795c01

Browse files
switch to reusable workflow
1 parent 7b87037 commit 9795c01

File tree

1 file changed

+5
-58
lines changed

1 file changed

+5
-58
lines changed

.github/workflows/docker-publish.yaml

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13,62 +13,9 @@ on:
1313
tags: [ 'v*.*.*' ]
1414
pull_request:
1515
branches: [ "main" ]
16-
17-
env:
18-
# Use docker.io for Docker Hub if empty
19-
REGISTRY: ghcr.io
20-
# github.repository as <account>/<repo>
21-
IMAGE_NAME: ${{ github.repository }}
22-
23-
2416
jobs:
25-
build:
26-
runs-on: ['self-hosted-ghr', 'size-s-x64']
27-
permissions:
28-
contents: read
29-
packages: write
30-
# This is used to complete the identity challenge
31-
# with sigstore/fulcio when running outside of PRs.
32-
id-token: write
33-
34-
steps:
35-
- name: Checkout repository
36-
uses: actions/checkout@v3
37-
38-
# Set up BuildKit Docker container builder to be able to build
39-
# multi-platform images and export cache
40-
# https://github.com/docker/setup-buildx-action
41-
- name: Set up Docker Buildx
42-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
43-
44-
# Login against a Docker registry except on PR
45-
# https://github.com/docker/login-action
46-
- name: Log into registry ${{ env.REGISTRY }}
47-
if: github.event_name != 'pull_request'
48-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
49-
with:
50-
registry: ${{ env.REGISTRY }}
51-
username: ${{ github.actor }}
52-
password: ${{ secrets.GITHUB_TOKEN }}
53-
54-
# Extract metadata (tags, labels) for Docker
55-
# https://github.com/docker/metadata-action
56-
- name: Extract Docker metadata
57-
id: meta
58-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
59-
with:
60-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61-
62-
# Build and push Docker image with Buildx (don't push on PR)
63-
# https://github.com/docker/build-push-action
64-
- name: Build and push Docker image
65-
id: build-and-push
66-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
67-
with:
68-
context: .
69-
push: ${{ github.event_name != 'pull_request' }}
70-
tags: ${{ steps.meta.outputs.tags }}
71-
labels: ${{ steps.meta.outputs.labels }}
72-
cache-from: type=gha
73-
cache-to: type=gha,mode=max
74-
17+
call-docker-build:
18+
uses: ethdevops/workflows/.github/workflows/basic-docker-build.yaml@main
19+
secrets:
20+
docker_registry_user: ${{ secrets.DOCKER_REGISTRY_USER }}
21+
docker_registry_password: ${{ secrets.DOCKER_REGISTRY_SECRET }}

0 commit comments

Comments
 (0)