Skip to content

Commit

Permalink
fix(ci): merge docker build & push (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
tk-o authored Jan 30, 2025
1 parent a30fff0 commit a38060c
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Run unit tests
run: pnpm -r test

ensrainbow-docker-build:
ensrainbow-docker-build-and-push:
runs-on: ubuntu-latest
needs: [static-analysis, unit-tests]
# we only build the docker image after a push to the branch
Expand All @@ -95,37 +95,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Docker image for ENSRainbow app
- name: Build & Push Docker image for ENSRainbow app
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}/ensrainbow
TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref == 'refs/heads/alpha' && 'alpha' || github.ref == 'refs/heads/subgraph' && 'subgraph' }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker build -f apps/ensrainbow/Dockerfile -t $IMAGE_NAME:$TAG -t $IMAGE_NAME:${{ github.sha }} .
docker save $IMAGE_NAME:$TAG $IMAGE_NAME:${{ github.sha }} > image.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@v4
with:
name: ensrainbow-docker-image
path: ensrainbow-docker-image.tar

ensrainbow-docker-push:
runs-on: ubuntu-latest
needs: [ensrainbow-docker-build]

steps:
- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: ensrainbow-docker-image

- name: Push Docker image for ENSRainbow app to GitHub Container Registry
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}/ensrainbow
TAG: latest
run: |
docker load < ensrainbow-docker-image.tar
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push $IMAGE_NAME:$TAG
docker push $IMAGE_NAME:${{ github.sha }}

0 comments on commit a38060c

Please sign in to comment.