small updates #235
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
name: Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: "recursive" | |
- name: Login to Github Container Registry | |
run: echo ${{ secrets.GHCR_PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build Docker Image | |
run: docker build -t ghcr.io/sharknoon/pixina . | |
- name: Push Image to Registry | |
run: docker push ghcr.io/sharknoon/pixina | |
clean: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete untagged Images | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GHCR_PAT }} | |
script: | | |
const response = await github.request("GET /user/packages/container/${{ env.PACKAGE_NAME }}/versions", | |
{ | |
per_page: ${{ env.PER_PAGE }} | |
} | |
); | |
for(version of response.data) { | |
if (version.metadata.container.tags.length == 0) { | |
console.log("Deleting " + version.id) | |
const deleteResponse = await github.request("DELETE /user/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { }); | |
console.log("Deleted " + deleteResponse.status) | |
} | |
} | |
env: | |
PACKAGE_NAME: pixina | |
PER_PAGE: 100 |