diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e7cc4a..410d07d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,4 @@ jobs: steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v27 - - run: nix develop . -c golangci-lint run --enable-all - - 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 }} + - run: nix develop . -c task ci-publish --GITHUB_USERNAME ${{ github.actor }} --GITHUB_PASSWORD ${{ secrets.GITHUB_TOKEN }} --GIT_TAG ${{ github.ref_name }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1f2f7c..a14638d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,5 +12,4 @@ jobs: steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v27 - - run: nix develop . -c golangci-lint run --enable-all - - run: nix develop . -c go test -v -race ./... + - run: nix develop . -c task ci -p diff --git a/Taskfile.yml b/Taskfile.yml index b6719b1..581640b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,25 +6,42 @@ tasks: cmds: - task: lint - 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: cmds: - - "{{.NIX_CMD_BASE}} golangci-lint run --enable-all" + - | + {{.NIX_CMD_BASE}} \ + golangci-lint run --enable-all test: cmds: - - "{{.NIX_CMD_BASE}} go test -v -race ./..." + - | + {{.NIX_CMD_BASE}} \ + go test -v -race ./... tidy: cmds: - go mod tidy - go mod vendor - - release: - cmds: - - "{{.NIX_CMD_BASE}} goreleaser release --clean" - - release-snapshot: - cmds: - - "{{.NIX_CMD_BASE}} goreleaser release --clean --snapshot"