name: Verify and publish checkpoint container on: push: branches: [main, 'codex/**'] workflow_dispatch: permissions: contents: read concurrency: group: dune-checkpoint-container cancel-in-progress: false jobs: container: runs-on: ubuntu-latest timeout-minutes: 45 env: DUNE_CONTAINER_IMAGE: ${{ vars.DUNE_CONTAINER_IMAGE || 'git.juiced.computer/admin/dune' }} steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '22' - run: npm ci - uses: docker/setup-buildx-action@v3 - name: Build container uses: docker/build-push-action@v6 with: context: . build-args: | BUILD_REVISION=${{ github.sha }} load: true tags: dune:verify - name: Verify isolated storage and HTTP behavior run: node tools/verify-container.mjs dune:verify - name: Configure container registry if: github.ref == 'refs/heads/main' env: REGISTRY_TOKEN: ${{ secrets.CONTAINER_REGISTRY_TOKEN }} REGISTRY_USERNAME: ${{ vars.DUNE_REGISTRY_USERNAME || github.repository_owner }} run: | if [[ -z "$REGISTRY_TOKEN" ]]; then echo '::error::Set the CONTAINER_REGISTRY_TOKEN repository secret to publish the verified image.' exit 1 fi if [[ -z "$REGISTRY_USERNAME" ]]; then echo '::error::Set the DUNE_REGISTRY_USERNAME repository variable to a registry account.' exit 1 fi image="${DUNE_CONTAINER_IMAGE,,}" if [[ "$image" != */* || "$image" == *[!a-z0-9._/:-]* || "${image#*/}" == *:* ]]; then echo '::error::DUNE_CONTAINER_IMAGE must be an untagged registry/owner/image name.' exit 1 fi registry="${image%%/*}" if [[ -z "$registry" || -z "${image#*/}" ]]; then echo '::error::DUNE_CONTAINER_IMAGE must include a registry and image name.' exit 1 fi printf 'DUNE_REGISTRY=%s\nDUNE_IMAGE=%s\n' "$registry" "$image" >> "$GITHUB_ENV" - name: Log in to container registry if: github.ref == 'refs/heads/main' uses: docker/login-action@v3 with: registry: ${{ env.DUNE_REGISTRY }} username: ${{ vars.DUNE_REGISTRY_USERNAME || github.repository_owner }} password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }} - name: Publish the verified image if: github.ref == 'refs/heads/main' env: REVISION: ${{ github.sha }} run: | docker tag dune:verify "$DUNE_IMAGE:sha-$REVISION" docker tag dune:verify "$DUNE_IMAGE:checkpoint" docker push "$DUNE_IMAGE:sha-$REVISION" docker push "$DUNE_IMAGE:checkpoint"