diff --git a/.github/workflows/ga-image-sanitize.yml b/.github/workflows/ga-image-sanitize.yml new file mode 100644 index 0000000..6739001 --- /dev/null +++ b/.github/workflows/ga-image-sanitize.yml @@ -0,0 +1,112 @@ +name: ๐Ÿงผ Sanitize โ€“ Generated Docker Images + +on: + pull_request: + types: [closed] + workflow_dispatch: + inputs: + keep-last: + description: > + Delete all untagged images except the last N + required: false + default: "1" + +jobs: + delete-pr-tagged-image: + name: ๐Ÿ—‘๏ธ Delete PR${{github.event.pull_request.number}} Image + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿš€ API Gateway image PR${{github.event.pull_request.number}} + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-api-gateway-app + token: ${{ secrets.GITHUB_TOKEN }} + tag: PR${{github.event.pull_request.number}} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿงฉ Inventory App image PR${{github.event.pull_request.number}} + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-inventory-app + token: ${{ secrets.GITHUB_TOKEN }} + tag: PR${{github.event.pull_request.number}} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿ’ป Postgres DB image PR${{github.event.pull_request.number}} + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-postgres-db + token: ${{ secrets.GITHUB_TOKEN }} + tag: PR${{github.event.pull_request.number}} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿฐ Rabbitmq image PR${{github.event.pull_request.number}} + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-rabbitmq + token: ${{ secrets.GITHUB_TOKEN }} + tag: PR${{github.event.pull_request.number}} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿ’ฐ Billing App image PR${{github.event.pull_request.number}} + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-billing-app + token: ${{ secrets.GITHUB_TOKEN }} + tag: PR${{github.event.pull_request.number}} + continue-on-error: true + + delete-untagged-images: + name: ๐Ÿ”ฅ Clear Untagged Images + needs: delete-pr-tagged-image + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ”ฅ Clear all untagged ๐Ÿš€ API Gateway image + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-api-gateway-app + token: ${{ secrets.GITHUB_TOKEN }} + untagged-keep-latest: ${{ github.event.inputs.keep-last }} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿงฉ Inventory App image + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-inventory-app + token: ${{ secrets.GITHUB_TOKEN }} + untagged-keep-latest: ${{ github.event.inputs.keep-last }} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿ’ป Postgres DB image + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-postgres-db + token: ${{ secrets.GITHUB_TOKEN }} + untagged-keep-latest: ${{ github.event.inputs.keep-last }} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿฐ Rabbitmq image + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-rabbitmq + token: ${{ secrets.GITHUB_TOKEN }} + untagged-keep-latest: ${{ github.event.inputs.keep-last }} + continue-on-error: true + + - name: ๐Ÿ—‘๏ธ Delete ๐Ÿ’ฐ Billing App image + uses: bots-house/ghcr-delete-image-action@v1.1.0 + with: + owner: 01-edu + name: content-billing-app + token: ${{ secrets.GITHUB_TOKEN }} + untagged-keep-latest: ${{ github.event.inputs.keep-last }} + continue-on-error: true