Skip to content

Commit

Permalink
wip: use deploy to release
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Feb 28, 2024
1 parent 2e809a8 commit bb893a4
Show file tree
Hide file tree
Showing 3 changed files with 378 additions and 11 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io

jobs:
test:
Expand Down Expand Up @@ -44,5 +44,7 @@ jobs:
restore-keys: |
${{ github.job }}-${{ runner.os }}-go-
- run: sudo apt-get update && sudo apt install -y libxml2-dev libxslt1-dev liblzma-dev zlib1g-dev
- run: make release
- run: make deploy
env:
KO_DOCKER_REPO: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
if: success()
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
.DEFAULT_GOAL := build

GO ?= go
GO_RUN_TOOLS ?= $(GO) run -modfile ./tools/go.mod
GO_TEST ?= $(GO_RUN_TOOLS) gotest.tools/gotestsum --format pkgname
GO_RELEASER ?= $(GO_RUN_TOOLS) github.com/goreleaser/goreleaser
GO_KO ?= $(GO_RUN_TOOLS) github.com/google/ko
GO_MOD ?= $(shell ${GO} list -m)
BASE_DIR ?= $(CURDIR)
GO ?= go
GO_RUN_TOOLS ?= $(GO) run -modfile ./tools/go.mod
GO_TEST ?= $(GO_RUN_TOOLS) gotest.tools/gotestsum --format pkgname
GO_RELEASER ?= $(GO_RUN_TOOLS) github.com/goreleaser/goreleaser
GO_KO ?= $(GO_RUN_TOOLS) github.com/google/ko
GO_MOD ?= $(shell ${GO} list -m)
BASE_DIR ?= $(CURDIR)

COMMANDS := $(notdir $(wildcard cmd/*))

.PHONY: build
build: ## Build the binary file.
$(GO_RELEASER) build --snapshot --clean
build: $(COMMANDS) ## Build the application.

$(filter-out $(CUSTOM_BUILD_BINARIES), $(COMMANDS)): ## Build artifact
$(GO) build -ldflags "$(LDFLAGS_STATIC)" -o $(BIN_OUTPUT_DIR)/$@ ./cmd/$@

.PHONY: generate
generate: ## Generate code.
Expand Down
Loading

0 comments on commit bb893a4

Please sign in to comment.