Skip to content

Commit

Permalink
include sha in image tag and update values.yaml on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
tshaynik committed Nov 14, 2023
1 parent 43b7e13 commit a2219ae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/autocommit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ on:
- PLT-6842-autodeploy
create:
tags:
- '*'
- runtime@v*
- marlowe-runtime-web@v*
- marlowe-apps@v*

jobs:
run:
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Deploy"
name: "Build and Push"
env:
CACHE_NAME: marlowe-temp
ALLOWED_URIS: "https://github.com https://api.github.com"
Expand All @@ -12,6 +12,7 @@ on:
push:
branches:
- main
- PLT-6842-autodeploy
tags:
- runtime@v*
- marlowe-runtime-web@v*
Expand Down Expand Up @@ -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"
Expand All @@ -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

0 comments on commit a2219ae

Please sign in to comment.