|
| 1 | +name: Build and Push eth2near Docker Image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - 'eth2near/**' |
| 10 | + - 'contracts/near/**' |
| 11 | + - '.github/workflows/eth2near-docker.yml' |
| 12 | + release: |
| 13 | + types: [published] |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +env: |
| 17 | + REGISTRY: europe-west4-docker.pkg.dev |
| 18 | + PROJECT_ID: bridge-misc |
| 19 | + REPOSITORY: omni-bridge-docker-images |
| 20 | + |
| 21 | +jobs: |
| 22 | + build-and-push: |
| 23 | + runs-on: warp-ubuntu-latest-x64-8x |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + id-token: write |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v5 |
| 31 | + |
| 32 | + - name: Set up Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v3 |
| 34 | + |
| 35 | + - name: Authenticate to Google Cloud |
| 36 | + uses: google-github-actions/auth@v2 |
| 37 | + with: |
| 38 | + credentials_json: ${{ secrets.GCP_SA_KEY }} |
| 39 | + |
| 40 | + - name: Configure Docker to use gcloud as credential helper |
| 41 | + run: gcloud auth configure-docker ${{ env.REGISTRY }} |
| 42 | + |
| 43 | + - name: Extract metadata |
| 44 | + id: meta |
| 45 | + uses: docker/metadata-action@v5 |
| 46 | + with: |
| 47 | + images: ${{ env.REGISTRY }}/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/eth2near |
| 48 | + tags: | |
| 49 | + type=ref,event=branch |
| 50 | + type=ref,event=pr |
| 51 | + type=semver,pattern={{version}} |
| 52 | + type=semver,pattern={{major}}.{{minor}} |
| 53 | + type=semver,pattern={{major}} |
| 54 | + type=sha,prefix={{branch}} |
| 55 | + type=raw,value=latest,enable={{is_default_branch}} |
| 56 | +
|
| 57 | + - name: Build and push Docker image |
| 58 | + id: build |
| 59 | + uses: docker/build-push-action@v6 |
| 60 | + with: |
| 61 | + context: . |
| 62 | + file: ./eth2near/Dockerfile |
| 63 | + push: true |
| 64 | + tags: ${{ steps.meta.outputs.tags }} |
| 65 | + labels: ${{ steps.meta.outputs.labels }} |
| 66 | + platforms: linux/amd64 |
| 67 | + cache-from: type=gha |
| 68 | + cache-to: type=gha,mode=max |
| 69 | + |
| 70 | + - name: Output image digest |
| 71 | + run: echo "Image pushed with digest ${{ steps.build.outputs.digest }}" |
0 commit comments