Skip to content

Commit

Permalink
Check image version
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenMaude committed May 15, 2024
1 parent 96295ca commit 5267674
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI

env:
IMAGE_NAME: research-template
IMAGE_VERSION: v0
PUBLIC_IMAGE_NAME: ghcr.io/opensafely-core/research-template
REGISTRY: ghcr.io

Expand Down Expand Up @@ -60,7 +61,7 @@ jobs:
run: docker load --input /tmp/image/research-template.tar.gz

- name: Tag Docker image for use with dev container
run: docker tag $IMAGE_NAME $PUBLIC_IMAGE_NAME:v0
run: docker tag $IMAGE_NAME $PUBLIC_IMAGE_NAME:$IMAGE_VERSION

- name: Checkout research template temporary devcontainer dev branch
uses: actions/checkout@v4
Expand All @@ -72,6 +73,13 @@ jobs:
with:
path: 'research-template/research-template-docker'

- name: Check that we have correct version of image in devcontainer.json
# Slightly brittle because jq doesn't strip comments
# See https://github.com/jqlang/jq/issues/1571
run: |
devcontainer_image=$(grep -v "//" .devcontainer/devcontainer.json | jq --raw-output .image)
test "$devcontainer_image" = "$PUBLIC_IMAGE_NAME:$IMAGE_VERSION"
- name: Build and run dev container task
uses: devcontainers/[email protected]
with:
Expand Down Expand Up @@ -106,7 +114,7 @@ jobs:
- name: Publish image
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login $REGISTRY -u ${{ github.actor }} --password-stdin
docker tag $IMAGE_NAME $PUBLIC_IMAGE_NAME:v0
docker tag $IMAGE_NAME $PUBLIC_IMAGE_NAME:$IMAGE_VERSION
docker tag $IMAGE_NAME $PUBLIC_IMAGE_NAME:latest
docker push $PUBLIC_IMAGE_NAME:v0
docker push $PUBLIC_IMAGE_NAME:$IMAGE_VERSION
docker push $PUBLIC_IMAGE_NAME:latest

0 comments on commit 5267674

Please sign in to comment.