Skip to content

Commit f1b9fbb

Browse files
committed
build image
1 parent 0207f27 commit f1b9fbb

1 file changed

Lines changed: 24 additions & 43 deletions

File tree

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: 'Build and Push Flow Emulator Image'
1+
name: 'Build and Push Mainnet Fork Emulator Image'
22

33
on:
44
push:
55
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
6+
- v0
7+
- nialexsan/mainnet-fork-test
108

119
# Manual trigger, with a flag to decide if we also push
1210
workflow_dispatch:
@@ -17,57 +15,40 @@ on:
1715
default: false
1816

1917
env:
20-
DOCKER_IMAGE_URL: us-west1-docker.pkg.dev/dl-flow-devex-staging/backend/flow-emulator:${{ github.sha }}
18+
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/flow-emulator-fork
2119

2220
jobs:
2321
build:
24-
name: Build Flow Emulator Image
22+
name: Build Mainnet Fork Emulator Image
2523
runs-on: ubuntu-latest
2624

2725
permissions:
2826
contents: read
29-
id-token: write
30-
31-
outputs:
32-
image-url: ${{ env.DOCKER_IMAGE_URL }}
27+
packages: write
3328

3429
steps:
35-
- name: 'Checkout'
36-
uses: 'actions/checkout@v4'
30+
- name: Checkout
31+
uses: actions/checkout@v4
3732
with:
3833
submodules: recursive
3934
token: ${{ secrets.GH_PAT }}
4035

41-
- name: 'Build Flow Emulator image'
42-
run: |
43-
docker build -t "${{ env.DOCKER_IMAGE_URL }}" .
44-
45-
push:
46-
name: Push Flow Emulator Image
47-
runs-on: ubuntu-latest
48-
needs: build
49-
50-
# Only run when manually dispatched *and* push=true
51-
if: ${{ github.event_name == 'workflow_dispatch' && inputs.push == true }}
52-
53-
permissions:
54-
contents: read
55-
id-token: write
56-
57-
steps:
58-
- id: 'auth'
59-
name: 'Authenticate to Google Cloud'
60-
uses: 'google-github-actions/auth@v2'
36+
- name: Log in to GHCR
37+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == true)
38+
uses: docker/login-action@v3
6139
with:
62-
workload_identity_provider: '${{ vars.BUILDER_WORKLOAD_IDENTITY_PROVIDER }}'
63-
service_account: '${{ vars.BUILDER_SERVICE_ACCOUNT }}'
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
6443

65-
- name: 'Set up gcloud'
66-
uses: 'google-github-actions/setup-gcloud@v1'
44+
- name: Build and push flow-emulator-fork
45+
uses: docker/build-push-action@v5
6746
with:
68-
project_id: ${{ vars.GAR_PROJECT_ID }}
69-
70-
- name: 'Push Flow Emulator image'
71-
run: |
72-
gcloud auth configure-docker ${{ vars.GAR_REGION }}-docker.pkg.dev
73-
docker push "${{ needs.build.outputs.image-url }}"
47+
context: .
48+
file: Dockerfile.mainnet-fork
49+
push: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == true) }}
50+
tags: |
51+
${{ env.IMAGE_NAME }}:latest
52+
${{ env.IMAGE_NAME }}:${{ github.sha }}
53+
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
54+
cache-to: type=inline

0 commit comments

Comments
 (0)