Automated CipherNode deployment #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Ciphernode | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'packages/ciphernode/**' | |
- 'packages/evm/contracts/**' | |
pull_request: | |
branches: | |
- 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: | |
deploy: | |
name: Deploy to GHCR | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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, tag, and push image to GHCR | |
id: build-image | |
env: | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
# Build the image | |
docker build -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest -f $DOCKERFILE_PATH . | |
# Push both tagged and latest images | |
docker push $IMAGE_NAME:$IMAGE_TAG | |
docker push $IMAGE_NAME:latest | |
# Output image details | |
echo "image=$IMAGE_NAME:$IMAGE_TAG" >> $GITHUB_OUTPUT | |
echo "image=$IMAGE_NAME:latest" >> $GITHUB_OUTPUT |