Skip to content

Commit

Permalink
add clean cache workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Oct 31, 2023
1 parent eda8b7c commit 9496b95
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/clean-cache-registry.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily
# schedule:
# - cron: '0 0 * * *' # Daily

permissions:
id-token: write
Expand All @@ -13,12 +13,36 @@ jobs:
environment: s941

steps:
- uses: actions/checkout@v3 #Clone Repo
- uses: actions/checkout@v5
with:
repository: Azure/acr-cli
ref: v0.8

- uses: actions/setup-go@v4
- run: go version
- run: make binaries

- name: Get GitHub Public IP
id: github_public_ip
uses: haythem/[email protected]

- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Add GitHub IP to StorageAccount
run: az acr network-rule add --name radixdevapp --ip-address ${{ steps.github_public_ip.outputs.ipv4 }}

- name: Create ACR Token
run: echo "token=$(az acr login --name=radixdevapp --expose-token | jq -r '.accessToken')" >> $GITHUB_OUTPUT
id: token

- name: Purge old cache
run: RADIX_ZONE_ENV=./scripts/radix-zone/radix_zone_dev.env .github/workflows/scripts/dailytasks.sh
run: /bin/acr purge --registry=radixdevapp.azurecr.io --password=${{steps.token.outputs.token}} --username= --filter='*/cache:.*' --ago=12h --untagged --dry-run

- name: Revoke GitHub IP on StorageAccount
run: az acr network-rule remove --name radixdevapp --ip-address ${{ steps.github_public_ip.outputs.ipv4 }}

0 comments on commit 9496b95

Please sign in to comment.