@@ -3,12 +3,6 @@ name: Reusable Docker build and push workflow
33on :
44 workflow_call :
55 inputs :
6- old_registry :
7- required : true
8- type : string
9- old_username :
10- required : true
11- type : string
126 new_registry :
137 required : true
148 type : string
3731 - name : Checkout
3832 uses : actions/checkout@v4
3933
40- # Login for 'main' branch to both registries
41- - name : Docker Login to fruoccopublic (Main)
42- if : ${{ inputs.push == true && github.ref_name == 'main' }}
43- uses : docker/login-action@v3
44- with :
45- registry : ${{ inputs.old_registry }}
46- username : ${{ inputs.old_username }}
47- password : ${{ secrets.DOCKER_PASSWORD }}
48-
4934 - name : Docker Login to cwydcontainerreg (Main)
5035 if : ${{ inputs.push == true && github.ref_name == 'main' }}
5136 uses : docker/login-action@v3
7055 id : date
7156 run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
7257
73- - name : Build Docker Image and optionally push (Old Registry)
74- if : ${{ github.ref_name == 'main' }}
75- uses : docker/build-push-action@v6
76- with :
77- context : .
78- file : ${{ inputs.dockerfile }}
79- push : ${{ inputs.push }}
80- cache-from : type=registry,ref=${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.head_ref || github.ref_name }}
81- tags : |
82- ${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.head_ref || 'default' }}
83- ${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ steps.date.outputs.date }}_${{ github.run_number }}
84-
8558 - name : Build Docker Image and optionally push (New Registry)
8659 if : ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo'|| github.ref_name == 'dependabotchanges' }}
8760 uses : docker/build-push-action@v6
0 commit comments