Skip to content

Commit

Permalink
fix(ci): set deploy testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewklau committed Dec 5, 2024
1 parent 41ef742 commit 9445ceb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 54 deletions.
34 changes: 26 additions & 8 deletions .github/workflows/workflow-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches: ['main']

jobs:
build:
build-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,25 +22,26 @@ jobs:
aggregates,
]
fail-fast: false

steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
- name: Get current image digest
run: |
CURRENT_DIGEST=$(docker manifest inspect ghcr.io/nearblocks/${{ matrix.service }}:latest | jq -r '.config.digest' || echo "")
echo "CURRENT_DIGEST=$CURRENT_DIGEST" >> $GITHUB_ENV
echo $GITHUB_ENV
- uses: docker/build-push-action@v5
id: build
with:
context: .
file: apps/${{ matrix.service }}/Dockerfile
Expand All @@ -52,3 +53,20 @@ jobs:
ghcr.io/nearblocks/${{ matrix.service }}:${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/nearblocks/${{ matrix.service }}:latest
cache-to: type=inline

- name: Get new image digest
run: |
NEW_DIGEST=$(docker manifest inspect ghcr.io/nearblocks/${{ matrix.service }}:latest | jq -r '.config.digest')
echo "NEW_DIGEST=$NEW_DIGEST" >> $GITHUB_ENV
- name: Deploy testnet
if: |
env.CURRENT_DIGEST != env.NEW_DIGEST &&
matrix.service != 'indexer-dex' &&
matrix.service != 'explorer-selector'
run: |
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > kubeconfig
export KUBECONFIG=$(pwd)/kubeconfig
kubectl set -n nearblocks-testnet image deployment/testnet-${{ matrix.service }} ${{ matrix.service }}=ghcr.io/nearblocks/${{ matrix.service }}:${{ github.sha }}
kubectl rollout -n nearblocks-testnet status deployment/testnet-${{ matrix.service }} --timeout=600s
46 changes: 0 additions & 46 deletions .github/workflows/workflow-deploy-mainnet.yaml

This file was deleted.

0 comments on commit 9445ceb

Please sign in to comment.