Skip to content

Commit

Permalink
Merge pull request #15 from cyber-dojo/update-after-switch-to-single-…
Browse files Browse the repository at this point in the history
…workflow

Add ci workflow job to push image tagged with :latest
  • Loading branch information
JonJagger committed Mar 23, 2024
2 parents a31f765 + a597156 commit 6fb9cc0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -272,3 +272,30 @@ jobs:
IMAGE_TAG: ${{ needs.kosli-trail.outputs.image_tag }}
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}


# 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 6fb9cc0

Please sign in to comment.