|
1 | | -name: 'Build and Push Flow Emulator Image' |
| 1 | +name: 'Build and Push Mainnet Fork Emulator Image' |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: |
6 | | - - main |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - main |
| 6 | + - v0 |
| 7 | + - nialexsan/mainnet-fork-test |
10 | 8 |
|
11 | 9 | # Manual trigger, with a flag to decide if we also push |
12 | 10 | workflow_dispatch: |
|
17 | 15 | default: false |
18 | 16 |
|
19 | 17 | 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 |
21 | 19 |
|
22 | 20 | jobs: |
23 | 21 | build: |
24 | | - name: Build Flow Emulator Image |
| 22 | + name: Build Mainnet Fork Emulator Image |
25 | 23 | runs-on: ubuntu-latest |
26 | 24 |
|
27 | 25 | permissions: |
28 | 26 | contents: read |
29 | | - id-token: write |
30 | | - |
31 | | - outputs: |
32 | | - image-url: ${{ env.DOCKER_IMAGE_URL }} |
| 27 | + packages: write |
33 | 28 |
|
34 | 29 | steps: |
35 | | - - name: 'Checkout' |
36 | | - uses: 'actions/checkout@v4' |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
37 | 32 | with: |
38 | 33 | submodules: recursive |
39 | 34 | token: ${{ secrets.GH_PAT }} |
40 | 35 |
|
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 |
61 | 39 | 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 }} |
64 | 43 |
|
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 |
67 | 46 | 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