Skip to content

Commit

Permalink
Ensure release_version is set to correct value
Browse files Browse the repository at this point in the history
- Build AWS ECR image for master branch changes
  • Loading branch information
DavisRayM authored and WinnyTroy committed Jul 13, 2021
1 parent 9427d56 commit f49317a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
file: ./docker/onadata-uwsgi/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
release_version=${{ github.event.inputs.versionTag || steps.get-version.outputs.VERSION }}
release_version=${{ github.event.inputs.versionTag || steps.get-version.outputs.VERSION || steps.get-branch-name.outputs.BRANCH }}
optional_packages=PyYAML django-redis
push: true
cache-from: type=local,src=/tmp/.buildx-cache
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/ecr-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types:
- "released"
push:
branches:
- "master"
workflow_dispatch:
inputs:
versionTag:
Expand All @@ -26,9 +29,14 @@ jobs:

- name: Get the version
id: get-version
if: github.event.inputs.versionTag == ''
if: github.event.inputs.versionTag == '' && github.event_name != 'push'
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Get the branch name
id: get-branch-name
if: github.event_name == 'push'
run: echo "##[set-output name=BRANCH;]$(echo ${GITHUB_REF#refs/heads/})"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down Expand Up @@ -59,14 +67,13 @@ jobs:
ssh: |
default=/tmp/ssh-agent.sock
build-args: |
release_version=${{ github.event.inputs.versionTag || steps.get-version.outputs.VERSION }}
release_version=${{ github.event.inputs.versionTag || steps.get-version.outputs.VERSION || steps.get-branch-name.outputs.BRANCH }}
optional_packages=PyYAML django-redis ${{ secrets.ECR_OPTIONAL_PACKAGES }}
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
${{ steps.login-ecr.outputs.registry }}/onaio/onadata:latest
${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ github.event.inputs.versionTag || steps.get-version.outputs.VERSION }}
${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ github.event.inputs.versionTag || steps.get-version.outputs.VERSION || steps.get-branch-name.outputs.BRANCH }}
- name: Image digest
run: echo ${{ steps.docker-build.outputs.digest }}

0 comments on commit f49317a

Please sign in to comment.