File tree Expand file tree Collapse file tree 3 files changed +52
-20
lines changed
Expand file tree Collapse file tree 3 files changed +52
-20
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,13 @@ name: pr
22
33on : [pull_request]
44
5+
56permissions : {}
67
8+ env :
9+ IMAGE : openpolicyagent/conftest
10+ PLATFORMS : linux/amd64,linux/arm64
11+
712jobs :
813 style :
914 runs-on : ubuntu-latest
6065 - name : build
6166 run : make build
6267
68+ - name : setup docker buildx
69+ run : docker buildx create --name conftestbuild --use
70+
71+ - name : Build Docker image
72+ uses : docker/build-push-action@v6
73+ with :
74+ context : .
75+ push : false
76+ tags : |
77+ ${{ env.IMAGE }}:latest
78+ platforms : ${{ env.PLATFORMS }}
79+
6380 - name : unit test
6481 run : make test
6582
Original file line number Diff line number Diff line change 44 push :
55 tags :
66 - ' v*'
7+ env :
8+ IMAGE : openpolicyagent/conftest
9+ PLATFORMS : linux/amd64,linux/arm64
710
811jobs :
912 release :
@@ -36,10 +39,37 @@ jobs:
3639 - name : setup docker buildx
3740 run : docker buildx create --name conftestbuild --use
3841
39- - name : push images
40- env :
41- VERSION : ${{ steps.get-version.outputs.VERSION }}
42- run : make push TAG=$VERSION
42+ - name : Build and push Docker image
43+ uses : docker/build-push-action@v6
44+ with :
45+ context : .
46+ push : true
47+ build-args : |
48+ VERSION=${{ steps.get-version.outputs.VERSION }}
49+ tags : |
50+ ${{ env.IMAGE }}:${{ steps.get-version.outputs.VERSION }}
51+ platforms : ${{ env.PLATFORMS }}
52+
53+ - name : Build and push Docker latest image
54+ uses : docker/build-push-action@v6
55+ with :
56+ context : .
57+ push : true
58+ build-args : |
59+ VERSION=${{ steps.get-version.outputs.VERSION }}
60+ tags : |
61+ ${{ env.IMAGE }}:latest
62+ platforms : ${{ env.PLATFORMS }}
63+
64+ - name : Build and push examples image
65+ uses : docker/build-push-action@v6
66+ with :
67+ context : .
68+ push : true
69+ target : examples
70+ tags : |
71+ ${{ env.IMAGE }}:examples
72+ platforms : ${{ env.PLATFORMS }}
4373
4474 - name : setup go
4575 uses : actions/setup-go@v4
5282 args : release --clean
5383 version : " ~> v1"
5484 env :
55- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
85+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 6464#
6565# #@ Releases
6666#
67-
68- .PHONY : image
69- image : # # Builds a Docker image for Conftest.
70- @$(DOCKER ) build . -t $(IMAGE ) :latest
71-
72- .PHONY : examples
73- examples : # # Builds the examples Docker image.
74- @$(DOCKER ) build . --target examples -t $(IMAGE ) :examples
75-
76- .PHONY : push
77- push : # # Pushes the examples and Conftest image to DockerHub. Requires `TAG` parameter.
78- @test -n " $( TAG) " || (echo " TAG parameter not set." && exit 1)
79- @$(DOCKER ) buildx build . --push --build-arg VERSION=" $( TAG) " -t $(IMAGE ) :$(TAG ) --platform $(DOCKER_PLATFORMS )
80- @$(DOCKER ) buildx build . --push --build-arg VERSION=" $( TAG) " -t $(IMAGE ) :latest --platform $(DOCKER_PLATFORMS )
81- @$(DOCKER ) buildx build . --push --target examples -t $(IMAGE ) :examples --platform $(DOCKER_PLATFORMS )
You can’t perform that action at this time.
0 commit comments