diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74e94119..892c45c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: exit 1 fi echo "Tag is $TAG" - echo "::set-output name=tag::$TAG" + echo "tag=$TAG" >> $GITHUB_OUTPUT - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Login to DockerHub @@ -46,11 +46,22 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push Docker image to registry + - name: Build Docker image + uses: docker/build-push-action@v7 + with: + context: . + load: true + tags: p4lang/pi:${{ steps.get-tag.outputs.tag }} + cache-from: type=gha + # A cache write must not fail the build. + cache-to: type=gha,mode=max,ignore-error=true + - name: Smoke test Docker image + run: | + docker run --rm p4lang/pi:${{ steps.get-tag.outputs.tag }} pi_convert_p4info -h + - name: Push Docker image to registry uses: docker/build-push-action@v7 with: context: . push: true tags: p4lang/pi:${{ steps.get-tag.outputs.tag }} cache-from: type=gha - cache-to: type=gha,mode=max