initial code (#6)

* initial code commit
This commit is contained in:
l3uddz
2021-02-14 16:18:26 +00:00
committed by GitHub
parent 3f55336fbd
commit ce3807b819
53 changed files with 3694 additions and 0 deletions

54
.github/workflows/cleanup.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: Docker Cleanup
on: delete
jobs:
cleanup_branch:
if: startsWith(github.event.ref_type, 'branch') == true
runs-on: ubuntu-latest
steps:
- name: Sanitize branch docker tag
uses: frabert/replace-string-action@master
id: dockertag
with:
pattern: '[:\.\/]+'
string: "${{ github.event.ref }}"
replace-with: '-'
flags: 'g'
- name: query for package version id
uses: octokit/graphql-action@v2.x
id: query_package_version
with:
query: |
query package($owner:String!,$repo:String!,$tag:String!) {
repository(owner: $owner, name: $repo) {
packages(names:[$repo], first:1) {
edges {
node {
id,
name,
version(version: $tag) {
id, version
}
}
}
}
}
}
owner: ${{ github.event.repository.owner.name }}
repo: ${{ github.event.repository.name }}
tag: ${{ steps.dockertag.outputs.replaced }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: parse package version id
id: package_version
run: echo "VERSION_ID=$(echo $json | jq -r $jsonpath)" >> $GITHUB_ENV
env:
json: ${{ steps.query_package_version.outputs.data }}
jsonpath: ".repository.packages.edges[].node.version.id"
- uses: actions/delete-package-versions@v1
with:
package-version-ids: '${{ env.VERSION_ID }}'