From bd0c5cddd9f4dc929f7b0e624213b751eb43f64c Mon Sep 17 00:00:00 2001 From: David Lehuby Date: Wed, 27 Sep 2023 13:37:51 +1000 Subject: [PATCH] Add Publish Workflows --- .github/workflows/publish.yml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..632a84521 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,49 @@ +name: publish + +on: + push: + branches: ['main'] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + ECR_REPOSITORY_URL: 673156464838.dkr.ecr.us-west-2.amazonaws.com + ECR_REPOSITORY_NAME: on-chain-voting + +jobs: + publish-server-image: + name: Build and Push Docker Image + runs-on: minafoundation-default-runners + steps: + - name: 📥 Checkout + uses: actions/checkout@v3 + - name: 🦀 Get node-stats-collector version from Cargo.toml. + id: ocv-server + uses: dante-signal31/rust-app-version@v1.2.0 + with: + cargo_toml_folder: ./server/ + - name: 🏷️ Generate Tag + run: echo "TAG=server-${{ steps.ocv-server.outputs.app_version }}-$(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: 🛠️ Build node-stats-collector Docker Image + if: steps.checktag.outputs.tag == 'not found' + run: docker build -t ${{ env.ECR_REPOSITORY_URL}}/${{ env.ECR_REPOSITORY_NAME }}:${{ env.TAG }} . + - name: 🚚 Push node-stats-collector Docker Image + if: steps.checktag.outputs.tag == 'not found' + run: docker push ${{ env.ECR_REPOSITORY_URL}}/${{ env.ECR_REPOSITORY_NAME }}:${{ env.TAG }} + - name: 📝 Release Notes + run: | + echo "Generate Release Notes" + echo "TODO: Generate Release Notes (https://github.com/MinaProtocol/mf-devops-workflows/issues/23)"