Skip to content

Commit

Permalink
ci: delete untagged packages (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladopajic authored Nov 19, 2024
1 parent ea8acb6 commit 63fe2c4
Showing 1 changed file with 38 additions and 23 deletions.
61 changes: 38 additions & 23 deletions .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,61 @@
name: action-test
on: [push]
jobs:
test:
name: test
build-dev-image:
name: build dev image
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and push
uses: docker/build-push-action@v6
with:
push: true
build-args: |
VERSION=dev
tags: |
ghcr.io/vladopajic/go-test-coverage:dev
- uses: actions/delete-package-versions@v5
with:
owner: vladopajic
package-name: go-test-coverage
package-type: container
min-versions-to-keep: 5
delete-only-untagged-versions: true
test:
name: test
runs-on: ubuntu-latest
needs: build-dev-image

steps:
- name: checkout
uses: actions/checkout@v4

- name: setup go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: generate test coverage
run: go test ./... -coverprofile=./cover.out -covermode=atomic

- name: set action image version to dev
run: |
yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml
image=$(yq '.runs.image' action.yml)
echo "Image: $image"
- name: login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and push
uses: docker/build-push-action@v6
with:
push: true
build-args: |
VERSION=dev
tags: |
ghcr.io/vladopajic/go-test-coverage:dev
- name: generate test coverage
run: go test ./... -coverprofile=./cover.out -covermode=atomic

## Test 1

- name: "test: total coverage 0% (config)"
Expand Down

0 comments on commit 63fe2c4

Please sign in to comment.