ci: using task in github actions
Some checks failed
release / release (push) Has been cancelled

This commit is contained in:
Marvin Preuss 2024-09-20 09:21:49 +02:00
parent aa139b5a09
commit c7975ea667
3 changed files with 30 additions and 16 deletions

View File

@ -10,6 +10,4 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27 - uses: cachix/install-nix-action@v27
- run: nix develop . -c golangci-lint run --enable-all - run: nix develop . -c task ci-publish --GITHUB_USERNAME ${{ github.actor }} --GITHUB_PASSWORD ${{ secrets.GITHUB_TOKEN }} --GIT_TAG ${{ github.ref_name }}
- run: nix develop . -c go test -v -race ./...
- run: nix develop . -c skopeo --insecure-policy copy --dest-username ${{ github.actor }} --dest-password ${{ secrets.GITHUB_TOKEN }} docker-archive://$(nix build .#docker --print-out-paths) docker://ghcr.io/xsteadfastx/caddy-log-exporter:${{ github.ref_name }}

View File

@ -12,5 +12,4 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27 - uses: cachix/install-nix-action@v27
- run: nix develop . -c golangci-lint run --enable-all - run: nix develop . -c task ci -p
- run: nix develop . -c go test -v -race ./...

View File

@ -6,25 +6,42 @@ tasks:
cmds: cmds:
- task: lint - task: lint
- task: test - task: test
- task: release-snapshot
ci-publish:
cmds:
- task: lint
- task: test
- task: docker
docker:
requires:
vars:
- GITHUB_USERNAME
- GITHUB_PASSWORD
- GIT_TAG
cmds:
- |
{{.NIX_CMD_BASE}} \
skopeo \
--insecure-policy \
copy \
--dest-username {{.GITHUB_USERNAME}} --dest-password {{.GITHUB_PASSWORD}} \
docker-archive://$(nix build .#docker --print-out-paths) \
docker://ghcr.io/xsteadfastx/caddy-log-exporter:{{.GIT_TAG}}
lint: lint:
cmds: cmds:
- "{{.NIX_CMD_BASE}} golangci-lint run --enable-all" - |
{{.NIX_CMD_BASE}} \
golangci-lint run --enable-all
test: test:
cmds: cmds:
- "{{.NIX_CMD_BASE}} go test -v -race ./..." - |
{{.NIX_CMD_BASE}} \
go test -v -race ./...
tidy: tidy:
cmds: cmds:
- go mod tidy - go mod tidy
- go mod vendor - go mod vendor
release:
cmds:
- "{{.NIX_CMD_BASE}} goreleaser release --clean"
release-snapshot:
cmds:
- "{{.NIX_CMD_BASE}} goreleaser release --clean --snapshot"