-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding action for deleting image (#209)
* Adding action for deleting image * Only trigger when deleting
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Delete tag from container registry | ||
|
||
on: | ||
delete: | ||
|
||
env: | ||
REGISTRY: cfaprdbatchcr.azurecr.io | ||
IMAGE_NAME: pyrenew-hew | ||
|
||
jobs: | ||
delete-container: | ||
runs-on: cfa-cdcgov | ||
name: Deleting the container | ||
|
||
steps: | ||
- name : Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
id: branch-name | ||
|
||
- name: Login to the Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: "cfaprdbatchcr.azurecr.io" | ||
username: "cfaprdbatchcr" | ||
password: ${{ secrets.CFAPRDBATCHCR_REGISTRY_PASSWORD }} | ||
|
||
- name: Deleting the image | ||
run: | | ||
az acr repository delete \ | ||
--name ${{ env.REGISTRY }} \ | ||
--image ${{ env.IMAGE_NAME }}:${{ steps.branch-name.outputs.branch}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters