Skip to content

Fix Peer Discovery Failing #15

Fix Peer Discovery Failing

Fix Peer Discovery Failing #15

name: Build and Deploy Ciphernode
on:
push:
branches:
- release
- main
paths:
- 'packages/ciphernode/**'
- 'packages/evm/contracts/**'
pull_request:
branches:
- release
- main
paths:
- 'packages/ciphernode/**'
- 'packages/evm/contracts/**'
env:
DOCKERFILE_PATH: packages/ciphernode/Dockerfile
IMAGE_NAME: ghcr.io/gnosisguild/ciphernode
permissions:
contents: read
packages: write
jobs:
build:
name: Build Image
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Generate version tag
id: version
run: echo "version=$(date +'%Y%m%d')-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
env:
IMAGE_TAG: ${{ steps.version.outputs.version }}
run: |
docker build -t $IMAGE_NAME:${{ steps.version.outputs.version }} -f $DOCKERFILE_PATH .
docker push $IMAGE_NAME:$IMAGE_TAG
- name: Push to GHCR
if: github.ref == 'refs/heads/release'
env:
IMAGE_TAG: ${{ steps.version.outputs.version }}
run: |
docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:latest
docker push $IMAGE_NAME:latest
deploy:
name: Deploy to Production
needs: build
runs-on: ubuntu-latest
environment:
name: production
if: github.ref == 'refs/heads/release'
steps:
- name: Deploy to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
script: |
IMAGE_TAG="${{ needs.build.outputs.image_tag }}"
echo "Deploying version: $IMAGE_TAG"
docker pull $IMAGE_NAME:$IMAGE_TAG
cd /home/ec2-user/enclave
git pull
docker stack deploy -c docker-compose.yml ciphernode-stack