2121jobs :
2222 build-test-push :
2323 runs-on : ubuntu-latest
24- strategy :
25- matrix :
26- platform : [linux/amd64, linux/arm64]
27- include :
28- - target_branch : main
29- branch : main
30- - target_branch : develop
31- branch : develop
3224 steps :
3325 # Check out the repository code
3426 - name : Checkout code
4335 uses : actions/cache@v2
4436 with :
4537 path : ${{ env.CACHE_PATH }}
46- key : ${{ runner.os }}-buildx-${{ matrix.branch }}-${{ matrix.platform }}-${{ hashFiles('**/Dockerfile') }}
38+ key : ${{ runner.os }}-buildx-${{ github.ref }}-${{ hashFiles('**/Dockerfile') }}
4739 restore-keys : |
48- ${{ runner.os }}-buildx-${{ matrix.branch }}-${{ matrix.platform }}-
49- ${{ runner.os }}-buildx-${{ matrix.branch }}-
40+ ${{ runner.os }}-buildx-${{ github.ref }}-
5041 ${{ runner.os }}-buildx-
5142
5243 # Log in to Docker Hub using the provided secrets
6253 run : |
6354 REPO=${{ env.DOCKERHUB_REPO }}
6455 IMAGE=${{ env.DOCKERHUB_IMAGE }}
56+ BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
6557
6658 if [ "${{ github.event_name }}" == "pull_request" ]; then
6759 PR_NUMBER=${{ github.event.number }}
8577 uses : docker/build-push-action@v2
8678 with :
8779 context : .
88- platforms : ${{ matrix.platform }}
80+ platforms : linux/amd64,linux/arm64
8981 push : ${{ github.event_name != 'pull_request' }}
9082 tags : ${{ steps.image_tags.outputs.tags }}
9183 cache-from : type=local,src=${{ env.CACHE_PATH }}
@@ -110,14 +102,5 @@ jobs:
110102 # --exit-code 1 \
111103 # --severity CRITICAL,HIGH \
112104 # --ignore-unfixed \
113- # ${{ env.DOCKERHUB_REPO }}/${{ env.DOCKERHUB_IMAGE }}:${IMAGE_TAG}
105+ # ${{ env.DOCKERHUB_REPO }}
114106
115-
116- # # Create an issue if the build fails
117- # - name: Create issue if build fails
118- # if: failure()
119- # uses: peter-evans/create-issue-from-file@v2
120- # with:
121- # title: "Docker Image CI failed for ${{ env.DOCKERHUB_REPO }}/${{ env.DOCKERHUB_IMAGE }}:${{ matrix.branch }}-${{ matrix.platform }}"
122- # content-filepath: .github/issue_templates/build_failure.md
123- # token: ${{ secrets.GITHUB_TOKEN }}
0 commit comments