Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade docker publish action to v2 #1962

Merged
merged 1 commit into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions .github/workflows/curator-service-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,34 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
-
name: Prepare
id: prep
run: |
DOCKER_IMAGE=${{github.repository}}/curatorservice
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be called as we are not building on PR, but okay to leave it I guess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I pasted that from the example docs and just deleted the outputs that I don't think we need, missed that bit.

VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
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')
- uses: docker/login-action@v2
with:
username: ${{ github.actor }}
# https://github.com/globaldothealth/list/settings/secrets
# https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
password: ${{ secrets.CR_PAT }}
registry: ghcr.io
repository: ${{github.repository}}/curatorservice
- uses: docker/build-push-action@v2
with:
dockerfile: verification/curator-service/Dockerfile
add_git_labels: true
tag_with_ref: true
tag_with_sha: true
tags: ${{ steps.prep.outputs.tags }}
27 changes: 22 additions & 5 deletions .github/workflows/data-service-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,32 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
-
name: Prepare
id: prep
run: |
DOCKER_IMAGE=${{github.repository}}/dataservice
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=tags::${TAGS}
- uses: docker/login-action@v2
with:
username: ${{ github.actor }}
# https://github.com/globaldothealth/list/settings/secrets
# https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
password: ${{ secrets.CR_PAT }}
registry: ghcr.io
repository: ${{github.repository}}/dataservice
- uses: docker/build-push-action@v2
with:
dockerfile: data-serving/data-service/Dockerfile
add_git_labels: true
tag_with_ref: true
tag_with_sha: true
tags: ${{ steps.prep.outputs.tags }}
27 changes: 22 additions & 5 deletions .github/workflows/geocoding-service-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,32 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
-
name: Prepare
id: prep
run: |
DOCKER_IMAGE=${{github.repository}}/locationservice
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [ "${{ github.event_name }}" = "push" ]; then
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
fi
echo ::set-output name=tags::${TAGS}
- uses: docker/login-action@v2
with:
username: ${{ github.actor }}
# https://github.com/globaldothealth/list/settings/secrets
# https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
password: ${{ secrets.CR_PAT }}
registry: ghcr.io
repository: ${{github.repository}}/locationservice
- uses: docker/build-push-action@v2
with:
dockerfile: geocoding/location-service/Dockerfile
add_git_labels: true
tag_with_ref: true
tag_with_sha: true
tags: ${{ steps.prep.outputs.tags }}