|
5 | 5 | paths:
|
6 | 6 | - .github/workflows/build.yml
|
7 | 7 | - ansible/playbooks/AdoptOpenJDK_Unix_Playbook/**
|
8 |
| - branches: |
| 8 | + - ansible/docker/** |
| 9 | + branches: |
9 | 10 | - master
|
10 | 11 | push:
|
11 | 12 | paths:
|
12 | 13 | - .github/workflows/build.yml
|
13 | 14 | - ansible/playbooks/AdoptOpenJDK_Unix_Playbook/**
|
14 |
| - branches: |
| 15 | + - ansible/docker/** |
| 16 | + branches: |
15 | 17 | - master
|
16 | 18 |
|
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
17 | 22 | jobs:
|
18 | 23 | build-and-push-centos6:
|
19 | 24 | name: Centos6
|
20 | 25 | runs-on: ubuntu-latest
|
21 | 26 | steps:
|
22 | 27 |
|
23 |
| - - uses: actions/checkout@v2 |
| 28 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 29 | + |
| 30 | + - name: Set up Docker Buildx to use cache feature |
| 31 | + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 |
24 | 32 |
|
25 |
| - - name: Docker Build & Push Centos6 Image to Docker Hub |
26 |
| - uses: docker/build-push-action@v1 |
| 33 | + - name: Login to Docker Hub |
| 34 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 |
27 | 35 | with:
|
28 | 36 | username: ${{ secrets.DOCKER_USERNAME }}
|
29 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
30 |
| - dockerfile: ./ansible/docker/Dockerfile.CentOS6 |
31 |
| - repository: adoptopenjdk/centos6_build_image |
32 |
| - tags: latest |
33 |
| - push: ${{ github.ref == 'refs/heads/master' }} |
| 37 | + password: ${{ secrets.DOCKER_TOKEN }} |
| 38 | + if: github.ref == 'refs/heads/master' |
| 39 | + |
| 40 | + |
| 41 | + - name: Docker Build CentOS6 Image Test |
| 42 | + uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1 |
| 43 | + with: |
| 44 | + file: ./ansible/docker/Dockerfile.CentOS6 |
| 45 | + build-args: git_sha=${{ github.sha }} |
| 46 | + tags: adoptopenjdk/centos6_build_image:latest |
| 47 | + cache-from: type=registry,ref=adoptopenjdk/centos6_build_image:latest |
| 48 | + cache-to: type=inline |
| 49 | + push: false |
| 50 | + if: github.ref != 'refs/heads/master' |
| 51 | + |
| 52 | + - name: Docker Build & Push Centos6 Image to Docker Hub On Merge |
| 53 | + uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1 |
| 54 | + with: |
| 55 | + file: ./ansible/docker/Dockerfile.CentOS6 |
| 56 | + build-args: git_sha=${{ github.sha }} |
| 57 | + tags: adoptopenjdk/centos6_build_image:latest |
| 58 | + cache-from: type=registry,ref=adoptopenjdk/centos6_build_image:latest |
| 59 | + cache-to: type=inline |
| 60 | + push: false |
| 61 | + if: github.ref == 'refs/heads/master' |
34 | 62 |
|
35 | 63 | build-and-push-alpine3:
|
36 | 64 | name: Alpine3
|
37 | 65 | runs-on: ubuntu-latest
|
38 | 66 | steps:
|
39 | 67 |
|
40 |
| - - uses: actions/checkout@v2 |
| 68 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
41 | 69 |
|
42 |
| - - name: Docker Build & Push Alpine3 Image to Docker Hub |
43 |
| - uses: docker/build-push-action@v1 |
| 70 | + - name: Set up Docker Buildx to use cache feature |
| 71 | + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 |
| 72 | + |
| 73 | + - name: Docker Build Alpine3 Image |
| 74 | + uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1 |
44 | 75 | with:
|
45 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
46 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
47 |
| - dockerfile: ./ansible/docker/Dockerfile.Alpine3 |
48 |
| - repository: adoptopenjdk/alpine3_build_image |
49 |
| - tags: latest |
50 |
| - push: ${{ github.ref == 'refs/heads/master' }} |
| 76 | + file: ./ansible/docker/Dockerfile.Alpine3 |
| 77 | + build-args: git_sha=${{ github.sha }} |
| 78 | + tags: adoptopenjdk/alpine3_build_image:latest |
| 79 | + cache-from: type=registry,ref=adoptopenjdk/alpine3_build_image:latest |
| 80 | + cache-to: type=inline |
| 81 | + push: false |
0 commit comments