|
1 | | -name: 'Deploy EVM Block Extractor docker image' |
| 1 | +name: 'Deploy EVM Block Extractor Docker Image' |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: {} |
|
8 | 8 | tags: |
9 | 9 | - 'v*' |
10 | 10 |
|
| 11 | +# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + packages: write |
| 15 | + |
11 | 16 | concurrency: |
12 | 17 | group: ${{ github.workflow }}-${{ github.ref }} |
13 | 18 | cancel-in-progress: true |
14 | 19 |
|
15 | | -# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. |
16 | 20 | env: |
17 | | - REGISTRY: ghcr.io |
18 | | - IMAGE_NAME: ${{github.repository_owner}}/evm-block-extractor |
| 21 | + IMAGE_NAME: evm-block-extractor |
| 22 | + GCP_REGISTRY: us-east4-docker.pkg.dev |
19 | 23 |
|
20 | | -# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. |
21 | 24 | jobs: |
22 | | - build-and-push-image: |
| 25 | + deploy-to-github: |
23 | 26 | runs-on: ubuntu-latest |
24 | | - # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. |
25 | | - permissions: |
26 | | - contents: read |
27 | | - packages: write |
28 | | - # |
| 27 | + |
29 | 28 | steps: |
30 | 29 | - name: Checkout repository |
31 | | - uses: actions/checkout@v4 |
| 30 | + uses: actions/checkout@v3 |
32 | 31 |
|
33 | | - - name: Log in to the Container registry |
| 32 | + - name: Log in to GitHub Container Registry |
34 | 33 | uses: docker/login-action@v3 |
35 | 34 | with: |
36 | | - registry: ${{ env.REGISTRY }} |
| 35 | + registry: ghcr.io |
37 | 36 | username: ${{ github.actor }} |
38 | 37 | password: ${{ secrets.GITHUB_TOKEN }} |
39 | 38 |
|
40 | 39 | - name: Extract metadata (tags, labels) for Docker |
41 | | - id: meta |
| 40 | + id: gh-meta |
| 41 | + uses: docker/metadata-action@v5 |
| 42 | + with: |
| 43 | + images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }} |
| 44 | + |
| 45 | + - name: Build and push Docker image to GitHub Container Registry |
| 46 | + uses: docker/build-push-action@v5 |
| 47 | + with: |
| 48 | + context: . |
| 49 | + file: ./src/evm-block-extractor/Dockerfile |
| 50 | + push: true |
| 51 | + tags: ${{ steps.gh-meta.outputs.tags }} |
| 52 | + |
| 53 | + deploy-to-gcp: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + needs: deploy-to-github |
| 56 | + steps: |
| 57 | + - name: Checkout repository |
| 58 | + uses: actions/checkout@v3 |
| 59 | + |
| 60 | + - name: Log in to GCP Registry |
| 61 | + uses: docker/login-action@v3 |
| 62 | + with: |
| 63 | + registry: ${{env.GCP_REGISTRY}} |
| 64 | + username: _json_key |
| 65 | + password: ${{ secrets.EXTRACTOR_GCP_DOCKER_KEY }} |
| 66 | + |
| 67 | + - name: Extract metadata (tags, labels) for Docker |
| 68 | + id: gcp-meta |
42 | 69 | uses: docker/metadata-action@v5 |
43 | 70 | with: |
44 | | - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 71 | + images: ${{env.GCP_REGISTRY}}/extractor-410310/block-extractor-repo/${{ env.IMAGE_NAME }} |
45 | 72 |
|
46 | | - - name: Build and push Docker image |
| 73 | + - name: Build and push Docker image to GCP Registry |
47 | 74 | uses: docker/build-push-action@v5 |
48 | 75 | with: |
49 | 76 | context: . |
50 | 77 | file: ./src/evm-block-extractor/Dockerfile |
51 | 78 | push: true |
52 | | - tags: ${{ steps.meta.outputs.tags }} |
53 | | - # labels: ${{ steps.meta.outputs.labels }} |
| 79 | + tags: ${{ steps.gcp-meta.outputs.tags }} |
0 commit comments