|
9 | 9 | - cron: 00 4 * * * |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - ghcr: |
| 12 | + php7: |
13 | 13 | runs-on: ubuntu-latest |
14 | 14 |
|
15 | 15 | steps: |
@@ -44,49 +44,81 @@ jobs: |
44 | 44 | severity: 'CRITICAL,HIGH' |
45 | 45 |
|
46 | 46 | - name: Retag new image with latest tag so we can push the scanned version |
47 | | - run: docker image tag php-docker-base:trivytemp ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:latest |
| 47 | + run: docker image tag php-docker-base:trivytemp ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:latest |
48 | 48 |
|
49 | 49 | - name: Push with latest tag |
50 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:latest |
| 50 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:latest |
51 | 51 | - name: Retag new image with commit hash |
52 | | - run: docker image tag ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:latest ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:$(echo ${GITHUB_SHA} | cut -c1-8) |
| 52 | + run: docker image tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:latest ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:$(echo ${GITHUB_SHA} | cut -c1-8) |
53 | 53 | - name: Push with commit hash tag |
54 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:$(echo ${GITHUB_SHA} | cut -c1-8) |
| 54 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:$(echo ${GITHUB_SHA} | cut -c1-8) |
55 | 55 | - name: Retag new image with php7 tag |
56 | | - run: docker image tag ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:latest ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php7 |
| 56 | + run: docker image tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:latest ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php7 |
57 | 57 | - name: Push with commit php7 tag |
58 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php7 |
| 58 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php7 |
59 | 59 |
|
60 | 60 | #php7-review |
61 | 61 | - name: Build the PHP7 review container image |
62 | | - run: docker build . --tag ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php7-review --file Dockerfile.php7-review |
| 62 | + run: docker build . --tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php7-review --file Dockerfile.php7-review |
63 | 63 | - name: Push with commit php7-review tag |
64 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php7-review |
| 64 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php7-review |
| 65 | + |
| 66 | + php8: |
| 67 | + runs-on: ubuntu-latest |
| 68 | + steps: |
| 69 | + - name: GitHub Environment Variables Action |
| 70 | + uses: FranzDiebold/github-env-vars-action@v2 |
| 71 | + |
| 72 | + - name: Shallow clone code |
| 73 | + uses: actions/checkout@v3 |
| 74 | + with: |
| 75 | + fetch-depth: 0 |
| 76 | + |
| 77 | + - name: Login to Container Registry ghcr.io |
| 78 | + uses: docker/login-action@v2 |
| 79 | + with: |
| 80 | + registry: ghcr.io |
| 81 | + username: ${{ github.actor }} |
| 82 | + password: ${{ secrets.GITHUB_TOKEN }} |
65 | 83 |
|
66 | 84 | #php8 |
67 | 85 | - name: Build the container image |
68 | | - run: docker build . --tag ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8 --file Dockerfile.php8 |
| 86 | + run: docker build . --tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8 --file Dockerfile.php8 |
69 | 87 | - name: Run Trivy vulnerability scanner |
70 | 88 | uses: aquasecurity/trivy-action@master |
71 | 89 | with: |
72 | | - image-ref: ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8 |
| 90 | + image-ref: ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8 |
73 | 91 | format: 'table' |
74 | 92 | exit-code: '1' |
75 | 93 | ignore-unfixed: true |
76 | 94 | vuln-type: 'os,library' |
77 | 95 | severity: 'CRITICAL,HIGH' |
78 | 96 | - name: Push with php8 tag |
79 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8 |
| 97 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8 |
80 | 98 | - name: Retag new image with commit hash |
81 | | - run: docker image tag ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8 ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8-$(echo ${GITHUB_SHA} | cut -c1-8) |
| 99 | + run: docker image tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8 ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8-$(echo ${GITHUB_SHA} | cut -c1-8) |
82 | 100 | - name: Push with commit hash tag and php8 tag |
83 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8-$(echo ${GITHUB_SHA} | cut -c1-8) |
| 101 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8-$(echo ${GITHUB_SHA} | cut -c1-8) |
84 | 102 |
|
85 | 103 | #php8-review |
86 | 104 | - name: Build the PHP8 review container image |
87 | | - run: docker build . --tag ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8-review --file Dockerfile.php8-review |
| 105 | + run: docker build . --tag ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8-review --file Dockerfile.php8-review |
88 | 106 | - name: Push with commit php8-review tag |
89 | | - run: docker push ghcr.io/linkorb/${{ env.CI_REPOSITORY_NAME }}:php8-review |
| 107 | + run: docker push ghcr.io/${{ github.repository_owner }}/${{ env.CI_REPOSITORY_NAME }}:php8-review |
| 108 | + |
| 109 | + cleanup: |
| 110 | + needs: [php7, php8] |
| 111 | + runs-on: ubuntu-latest |
| 112 | + steps: |
| 113 | + - name: GitHub Environment Variables Action |
| 114 | + uses: FranzDiebold/github-env-vars-action@v2 |
| 115 | + |
| 116 | + - name: Login to Container Registry ghcr.io |
| 117 | + uses: docker/login-action@v2 |
| 118 | + with: |
| 119 | + registry: ghcr.io |
| 120 | + username: ${{ github.actor }} |
| 121 | + password: ${{ secrets.GITHUB_TOKEN }} |
90 | 122 |
|
91 | 123 | - name: Delete old versions of the package, keeping a few of the newest |
92 | 124 | uses: actions/delete-package-versions@v4 |
|
0 commit comments