Skip to content

Commit

Permalink
PR for #320 tag image latest if GitHub ref is master (#359)
Browse files Browse the repository at this point in the history
* #320 first version Docker Build Push GH Action

* #320 2nd version Docker Build Push GH Action

* #320 2ndversion Docker Build Push GH Action textedit

* #320 use v2 Docker Build Push GH Action

* #320 use v2 Docker Build Push GH Action remove comments

* #320 use v2 Docker Build Push GH Action fix yaml error

* #320 use v2 Docker Build Push GH Action badge

* #320 use v2 Docker Build Push GH Run GHC Unit Tests in Docker

* #320 use v2 Docker Build Push try load Docker Image in build env

* #320 use v2 Docker Build Push - finalize

* #320 use v2 Docker Build Push - comments only

* #320 use v2 Docker Build Push - retain local Image always

* #320 use v2 Docker Build Push - tag with latest for master branch

* #320 use v2 Docker Build Push - use output var refs
  • Loading branch information
justb4 committed Apr 27, 2021
1 parent 7a9da98 commit 8e95de6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ jobs:
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
if [[ $VERSION == master ]]; then
VERSION=latest
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Show Image Settings
run: echo "IMAGE=${{ steps.prep.outputs.image }} VERSION=${{ steps.prep.outputs.version }} TAGS=${{ steps.prep.outputs.tags }}"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand All @@ -70,8 +77,8 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}
- name: GHC Unit Tests with Docker Image
run: docker run --entrypoint "/run-tests.sh" geopython/geohealthcheck:${{ steps.prep.outputs.version }}
run: docker run --entrypoint "/run-tests.sh" ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.version }}

- name: Push to Docker repo (on GH Push only)
if: ${{ github.event_name == 'push' }}
run: docker push geopython/geohealthcheck:${{ steps.prep.outputs.version }}
run: docker push ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.version }}

0 comments on commit 8e95de6

Please sign in to comment.