|
| 1 | +name: Build and Push Docker Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + tags: [ 'v*.*.*' ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + |
| 10 | +env: |
| 11 | + REGISTRY: ghcr.io |
| 12 | + IMAGE_NAME_CFG: ${{ github.repository }}-cfg |
| 13 | + IMAGE_NAME_EVM: ${{ github.repository }}-evm |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-and-push: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Log in to the Container registry |
| 27 | + uses: docker/login-action@v3 |
| 28 | + with: |
| 29 | + registry: ${{ env.REGISTRY }} |
| 30 | + username: ${{ github.actor }} |
| 31 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
| 33 | + - name: Extract metadata (tags, labels) for CFG |
| 34 | + id: meta-cfg |
| 35 | + uses: docker/metadata-action@v5 |
| 36 | + with: |
| 37 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_CFG }} |
| 38 | + tags: | |
| 39 | + type=ref,event=branch |
| 40 | + type=ref,event=pr |
| 41 | + type=semver,pattern={{version}} |
| 42 | + type=semver,pattern={{major}}.{{minor}} |
| 43 | + type=semver,pattern={{major}} |
| 44 | + type=sha |
| 45 | +
|
| 46 | + - name: Extract metadata (tags, labels) for EVM |
| 47 | + id: meta-evm |
| 48 | + uses: docker/metadata-action@v5 |
| 49 | + with: |
| 50 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_EVM }} |
| 51 | + tags: | |
| 52 | + type=ref,event=branch |
| 53 | + type=ref,event=pr |
| 54 | + type=semver,pattern={{version}} |
| 55 | + type=semver,pattern={{major}}.{{minor}} |
| 56 | + type=semver,pattern={{major}} |
| 57 | + type=sha |
| 58 | +
|
| 59 | + - name: Build and push CFG Docker image |
| 60 | + uses: docker/build-push-action@v5 |
| 61 | + with: |
| 62 | + context: . |
| 63 | + file: Dockerfile.cfg |
| 64 | + push: ${{ github.event_name != 'pull_request' }} |
| 65 | + tags: ${{ steps.meta-cfg.outputs.tags }} |
| 66 | + labels: ${{ steps.meta-cfg.outputs.labels }} |
| 67 | + |
| 68 | + - name: Build and push EVM Docker image |
| 69 | + uses: docker/build-push-action@v5 |
| 70 | + with: |
| 71 | + context: . |
| 72 | + file: Dockerfile.evm |
| 73 | + push: ${{ github.event_name != 'pull_request' }} |
| 74 | + tags: ${{ steps.meta-evm.outputs.tags }} |
| 75 | + labels: ${{ steps.meta-evm.outputs.labels }} |
0 commit comments