add reusable workflow 'ArtifactCleanUp'

This commit is contained in:
umarcor
2021-11-30 00:27:30 +01:00
parent 8e3ff6387c
commit 7115cf79be
2 changed files with 42 additions and 21 deletions

34
.github/workflows/ArtifactCleanUp.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: ArtifactCleanUp
on:
workflow_call:
inputs:
package:
description: 'Artifacts to be removed on not tagged runs.'
required: true
type: string
remaining:
description: 'Artifacts to be removed unconditionally.'
required: false
default: ''
type: string
jobs:
ArtifactCleanUp:
name: 🗑️ Artifact Cleanup
runs-on: ubuntu-latest
steps:
- name: 🗑️ Delete package Artifacts
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
uses: geekyeggo/delete-artifact@v1
with:
name: ${{ inputs.package }}
- name: 🗑️ Delete remaining Artifacts
if: ${{ inputs.remaining != '' }}
uses: geekyeggo/delete-artifact@v1
with:
name: ${{ inputs.remaining }}

View File

@@ -111,30 +111,17 @@ jobs:
coverage: ${{ fromJson(needs.Params.outputs.params).artifacts.coverage }}
typing: ${{ fromJson(needs.Params.outputs.params).artifacts.typing }}
ArtifactCleanUp:
name: 🗑️ Artifact Cleanup
runs-on: ubuntu-latest
uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@main
needs:
- Params
- Coverage
- StaticTypeCheck
- BuildTheDocs
- PublishToGitHubPages
steps:
- name: 🗑️ Delete package Artifacts
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
uses: geekyeggo/delete-artifact@v1
with:
name: |
${{ fromJson(needs.Params.outputs.params).artifacts.package }}
- name: 🗑️ Delete remaining Artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
package: ${{ fromJson(needs.Params.outputs.params).artifacts.package }}
remaining: |
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-*
${{ fromJson(needs.Params.outputs.params).artifacts.coverage }}
${{ fromJson(needs.Params.outputs.params).artifacts.typing }}