Skip to content

Publish

Publish #3

Workflow file for this run

name: Publish
on:
# push:
# tags:
# - '*'
workflow_dispatch:
inputs:
docker_tag_prefix:
description: "Enter the Docker Tag Prefix (e.g adhoc-test)"
required: true
type: string
mina_branch:
description: 'Branch of MinaProtocol/mina to build from'
required: true
default: 'delegation_verify_over_stdin_rc_base'
dune_profile:
description: 'Dune profile to build with'
required: true
default: 'devnet'
env:
ECR_REPOSITORY_URL: 673156464838.dkr.ecr.us-west-2.amazonaws.com
ECR_REPOSITORY_NAME: delegation-verify
DOCKER_TAG_PREFIX: ${{ github.event.inputs.docker_tag_prefix }}
MINA_BRANCH: ${{ github.event.inputs.mina_branch }}
DUNE_PROFILE: ${{ github.event.inputs.dune_profile }}
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-docker-image:
name: Build and Push Docker Image
runs-on: minafoundation-default-runners
steps:
- name: πŸ“₯ Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: 🏷️ Generate Tag
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
PREFIX=${{ env.DOCKER_TAG_PREFIX }}
elif [ "${{ github.event_name }}" == "push" ] && [ -n "${{ github.event.ref }}" ]; then
PREFIX=$(basename ${{ github.ref }})
else
echo "Invalid event. Exiting..."
exit 1
fi
echo "TAG=$PREFIX-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: πŸ”‘ ECR Login
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: πŸ” Check if Tag already exists
id: checktag
uses: tyriis/docker-image-tag-exists@main
with:
registry: ${{ env.ECR_REPOSITORY_URL}}
repository: ${{ env.ECR_REPOSITORY_NAME }}
tag: ${{ env.TAG }}
- name: πŸ“¦ Install Nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: πŸ› οΈ Build Uptime Service Backend Docker Image
if: steps.checktag.outputs.tag == 'not found'
run: |
TAG=${{ env.TAG }}
MINA_BRANCH=${{ env.MINA_BRANCH }}
DUNE_PROFILE=${{ env.DUNE_PROFILE }}
nix-shell --run "make docker-delegation-verify"
- name: 🚚 Push Uptime Service Backend Docker Image
if: steps.checktag.outputs.tag == 'not found'
run: docker push ${{ env.ECR_REPOSITORY_URL}}/${{ env.ECR_REPOSITORY_NAME }}:${{ env.TAG }}