File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 2727 - name : Checkout the repo
2828 uses : actions/checkout@v2
2929
30- - name : Build container image
31- run : docker build -t $(echo $REGISTRY)/$(echo $IMAGE_NAME):$(echo $GITHUB_SHA | head -c7) .
30+ - name : Build and tag container image
31+ run : |
32+ # Tag the image with both 'latest' and the specific commit SHA
33+ docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} .
3234
3335 - name : Install doctl
3436 uses : digitalocean/action-doctl@v2
4244 run : if [ ! -z "$(doctl registry repository list | grep "$(echo $IMAGE_NAME)")" ]; then doctl registry repository delete-manifest $(echo $IMAGE_NAME) $(doctl registry repository list-tags $(echo $IMAGE_NAME) | grep -o "sha.*") --force; else echo "No repository"; fi
4345
4446 - name : Push image to DigitalOcean Container Registry
45- run : docker push $(echo $REGISTRY)/$(echo $IMAGE_NAME):$(echo $GITHUB_SHA | head -c7)
47+ run : |
48+ # Push both tags to the registry
49+ docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
50+ docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
4651
4752 deploy :
4853 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments