|
1 | | -name: Docker |
2 | | - |
3 | | -# This workflow uses actions that are not certified by GitHub. |
4 | | -# They are provided by a third-party and are governed by |
5 | | -# separate terms of service, privacy policy, and support |
6 | | -# documentation. |
| 1 | +name: Build Docker image |
7 | 2 |
|
8 | 3 | on: |
9 | 4 | push: |
|
13 | 8 | pull_request: |
14 | 9 | branches: [ "main" ] |
15 | 10 |
|
16 | | -env: |
17 | | - # Use docker.io for Docker Hub if empty |
18 | | - REGISTRY: ghcr.io |
19 | | - # github.repository as <account>/<repo> |
20 | | - IMAGE_NAME: ${{ github.repository }} |
21 | | - |
22 | | - |
23 | | -jobs: |
| 11 | + jobs: |
24 | 12 | lint: |
25 | 13 | runs-on: ubuntu-latest |
26 | 14 | steps: |
|
60 | 48 | echo '```' >> $GITHUB_STEP_SUMMARY |
61 | 49 | pytest >> $GITHUB_STEP_SUMMARY |
62 | 50 | echo '```' >> $GITHUB_STEP_SUMMARY |
63 | | - build: |
| 51 | + ucall-docker-build: |
64 | 52 | needs: test |
65 | | - runs-on: ubuntu-latest |
66 | | - permissions: |
67 | | - contents: read |
68 | | - packages: write |
69 | | - # This is used to complete the identity challenge |
70 | | - # with sigstore/fulcio when running outside of PRs. |
71 | | - id-token: write |
72 | | - |
73 | | - steps: |
74 | | - - name: Checkout repository |
75 | | - uses: actions/checkout@v3 |
76 | | - |
77 | | - # Set up BuildKit Docker container builder to be able to build |
78 | | - # multi-platform images and export cache |
79 | | - # https://github.com/docker/setup-buildx-action |
80 | | - - name: Set up Docker Buildx |
81 | | - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 |
82 | | - |
83 | | - # Login against a Docker registry except on PR |
84 | | - # https://github.com/docker/login-action |
85 | | - - name: Log into registry ${{ env.REGISTRY }} |
86 | | - if: github.event_name != 'pull_request' |
87 | | - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 |
88 | | - with: |
89 | | - registry: ${{ env.REGISTRY }} |
90 | | - username: ${{ github.actor }} |
91 | | - password: ${{ secrets.GITHUB_TOKEN }} |
92 | | - |
93 | | - # Extract metadata (tags, labels) for Docker |
94 | | - # https://github.com/docker/metadata-action |
95 | | - - name: Extract Docker metadata |
96 | | - id: meta |
97 | | - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 |
98 | | - with: |
99 | | - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
100 | | - |
101 | | - # Build and push Docker image with Buildx (don't push on PR) |
102 | | - # https://github.com/docker/build-push-action |
103 | | - - name: Build and push Docker image |
104 | | - id: build-and-push |
105 | | - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 |
106 | | - with: |
107 | | - context: . |
108 | | - push: ${{ github.event_name != 'pull_request' }} |
109 | | - tags: ${{ steps.meta.outputs.tags }} |
110 | | - labels: ${{ steps.meta.outputs.labels }} |
111 | | - cache-from: type=gha |
112 | | - cache-to: type=gha,mode=max |
113 | | - |
| 53 | + uses: ethdevops/workflows/.github/workflows/basic-docker-build.yaml@main |
| 54 | + secrets: |
| 55 | + docker_registry_user: ${{ secrets.DOCKER_REGISTRY_USER }} |
| 56 | + docker_registry_password: ${{ secrets.DOCKER_REGISTRY_SECRET }} |
0 commit comments