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