Skip to content

Commit

Permalink
Add ci workflow job to push image tagged with :latest (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Mar 23, 2024
1 parent 4b8a47c commit 33e249a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -345,3 +345,30 @@ jobs:
uses: ./.github/workflows/sub_deploy_to_prod.yml
with:
IMAGE_TAG: ${{ needs.kosli-trail.outputs.image_tag }}


# The cyberdojo/versioner refresh-env.sh script
# https://github.com/cyber-dojo/versioner/blob/master/sh/refresh-env.sh
# relies on being able to:
# - get the :latest image
# - extract the SHA env-var embedded inside it
# - use the 1st 7 chars of the SHA as a latest-equivalent tag

push-latest:
needs: [deploy-to-prod, kosli-trail]
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ needs.kosli-trail.outputs.image_name }}
steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Tag image to :latest and push to Dockerhub Registry
run: |
docker pull "${IMAGE_NAME}"
docker tag "${IMAGE_NAME}" cyberdojo/${{ env.SERVICE_NAME }}:latest
docker push cyberdojo/${{ env.SERVICE_NAME }}:latest

0 comments on commit 33e249a

Please sign in to comment.