From a2219ae73e272540a39e39b608c0e38d54607fec Mon Sep 17 00:00:00 2001 From: Daniel KT Date: Tue, 14 Nov 2023 12:01:23 -0500 Subject: [PATCH] include sha in image tag and update values.yaml on tags --- .github/workflows/autocommit.yaml | 32 ++++++++++++++++++------------- .github/workflows/deploy.yml | 18 ++++++++--------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/autocommit.yaml b/.github/workflows/autocommit.yaml index 42b8ccdae7..61a28d448f 100644 --- a/.github/workflows/autocommit.yaml +++ b/.github/workflows/autocommit.yaml @@ -7,7 +7,9 @@ on: - PLT-6842-autodeploy create: tags: - - '*' + - runtime@v* + - marlowe-runtime-web@v* + - marlowe-apps@v* jobs: run: @@ -20,21 +22,25 @@ jobs: # ref: main ref: PLT-6842-autodeploy - - name: Set up environment - run: | - echo "VERSION=${GITHUB_SHA::8}" >> $GITHUB_ENV - - if [ "${{ github.event_name }}" = push ]; then - echo TYPE=qa >> $GITHUB_ENV - else - echo TYPE=demo >> $GITHUB_ENV - fi - - name: Update publish version id: update run: | - yq e -i '.instances.qa.tag = env(VERSION)' deploy/marlowe-runtime/values.yaml - yq e -i '.instances.qa.webTag = env(VERSION)' deploy/marlowe-runtime/values.yaml + if [[ "${{ github.ref }}" == "refs/tags/runtime@v"* ]] + then + export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^runtime@v//") + echo TAG=$TAG + yq e -i '.instances.demo.webTag = env(TAG)' deploy/marlowe-runtime/values.yaml + elif [[ "${{ github.ref }}" == "refs/tags/marlowe-runtime-web@v"* ]] + then + export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^marlowe-runtime-web@v//") + echo TAG=$TAG + yq e -i '.instances.demo.webTag = env(TAG)' deploy/marlowe-runtime/values.yaml + else + export "TAG=${GITHUB_SHA::8}" + echo TAG=$TAG + yq e -i '.instances.qa.tag = env(TAG)' deploy/marlowe-runtime/values.yaml + yq e -i '.instances.qa.webTag = env(TAG)' deploy/marlowe-runtime/values.yaml + fi - name: Commit changes uses: EndBug/add-and-commit@v7 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2b7c39de65..97532ae817 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: "Deploy" +name: "Build and Push" env: CACHE_NAME: marlowe-temp ALLOWED_URIS: "https://github.com https://api.github.com" @@ -12,6 +12,7 @@ on: push: branches: - main + - PLT-6842-autodeploy tags: - runtime@v* - marlowe-runtime-web@v* @@ -74,9 +75,14 @@ jobs: tagAndPush "marlowe-scaling" tagAndPush "marlowe-oracle" tagAndPush "marlowe-finder" - elif [[ "${{ github.ref }}" == "refs/heads/main" ]] + elif [[ "${{ github.ref }}" == "refs/tags/marlowe-runtime-web@v"* ]] then - export TAG=latest + # Strip "marlowe-runtime-web@v" prefix from tag name + export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^marlowe-runtime-web@v//") + echo TAG=$TAG + tagAndPush "marlowe-web-server" + else + export "TAG=${GITHUB_SHA::8}" echo TAG=$TAG tagAndPush "marlowe-chain-indexer" tagAndPush "marlowe-chain-sync" @@ -90,10 +96,4 @@ jobs: tagAndPush "marlowe-scaling" tagAndPush "marlowe-oracle" tagAndPush "marlowe-finder" - elif [[ "${{ github.ref }}" == "refs/tags/marlowe-runtime-web@v"* ]] - then - # Strip "marlowe-runtime-web@v" prefix from tag name - export TAG=$(echo "${{ github.ref_name }}" | sed -e "s/^marlowe-runtime-web@v//") - echo TAG=$TAG - tagAndPush "marlowe-web-server" fi