Skip to content

Commit

Permalink
updates to build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sharknoon committed Feb 23, 2024
1 parent 00d7c96 commit 3defc14
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
permissions:
packages: write

name: Build
on:
push:
Expand All @@ -8,12 +11,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Login to Github Container Registry
run: echo ${{ secrets.GHCR_PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Docker Image
run: docker build -t ghcr.io/sharknoon/pixina .
Expand All @@ -25,23 +28,9 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- name: Delete untagged Images
uses: actions/github-script@v3
- name: Delete old image versions
uses: actions/delete-package-versions@v5
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
package-type: 'container'
package-name: 'pixina'
min-versions-to-keep: 1

0 comments on commit 3defc14

Please sign in to comment.