From e71abda28f2d6e53c3bcc6ea17010fe253023e25 Mon Sep 17 00:00:00 2001 From: Mantra Date: Tue, 3 Dec 2024 15:20:45 +0000 Subject: [PATCH] add conditional step to make new docker image --- .github/workflows/build.yml | 5 ----- .github/workflows/test.yml | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32387998..b704ed16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,6 @@ jobs: ghcr-username: ${{ github.actor }} ghcr-password: ${{ secrets.GITHUB_TOKEN }} - - name: Checking - run: | - GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) - curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976" -H "accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer ${GHCR_TOKEN}" - - name: Build and push docker uses: docker/build-push-action@v5 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3d3054c..f69daea8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,3 +83,20 @@ jobs: run: npm run lint --prefix=app/server - name: Lint front end run: npm run lint --prefix=app/static + + publish-latest-image: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/mrc-5976' + needs: [fe-unit-tests, be-unit-tests, integration-tests, playwright-tests, lint] + steps: + - name: Publish image manifest to latest + run: | + GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64) + curl "https://ghcr.io/v2/mrc-ide/wodin/manifests/mrc-5976" \ + -H "accept: application/vnd.docker.distribution.manifest.v2+json" \ + -H "Authorization: Bearer ${GHCR_TOKEN}" \ + > manifest.json + curl -XPUT "https://ghcr.io/v2/mrc-ide/wodin/manifests/test-latest" \ + -H "content-type: application/vnd.docker.distribution.manifest.v2+json" \ + -H "Authorization: Bearer ${GHCR_TOKEN}" \ + -d '@d manifest.json'