diff --git a/Makefile b/Makefile index bcde26f..70d8bdd 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ help: ## Show target prefixes and available targets. @printf " run-* Processes and commands that run inside the dev container.\n" @printf "\nGeneral:\n" @awk 'BEGIN {FS = ":.*## "}; /^help:.*## / {printf "%-28s %s\n", $$1, $$2}' $(MAKEFILE_LIST) - @awk 'BEGIN {FS = ":.*## "}; /^build-[a-zA-Z0-9_-]+:.*## / {printf "%-28s %s\n", $$1, $$2}' $(MAKEFILE_LIST) + @awk 'BEGIN {FS = ":.*## "}; /^(build|deploy)-[a-zA-Z0-9_-]+:.*## / {printf "%-28s %s\n", $$1, $$2}' $(MAKEFILE_LIST) @printf "\ndev-* targets:\n" @awk 'BEGIN {FS = ":.*## "}; /^dev-[a-zA-Z0-9_-]+:.*## / {printf "%-28s %s\n", $$1, $$2}' $(MAKEFILE_LIST) @printf "\ndc-* targets:\n" @@ -74,6 +74,14 @@ build-tq-dev: ## Build tq and service binaries with the dev profile. go build -o "$(HOME)/.tasq-dev/system/bin/orchestrator" ./cmd/orchestrator go build -ldflags "-X github.com/version-1/tasq/internal/buildinfo.commit=$(TQ_BUILD_COMMIT)" -o "$(HOME)/.tasq-dev/system/bin/web" ./cmd/web +.PHONY: deploy-tq-dev +deploy-tq-dev: ## Stop services, build tqdev, deploy it, and restart services. Usage: make deploy-tq-dev [ARGS=/path/to/bin] + tqdev service stop + $(MAKE) build-tq-dev + mkdir -p "$(if $(strip $(ARGS)),$(ARGS),$(HOME)/.local/bin)" + mv ./tqdev "$(if $(strip $(ARGS)),$(ARGS),$(HOME)/.local/bin)/tqdev" + "$(if $(strip $(ARGS)),$(ARGS),$(HOME)/.local/bin)/tqdev" service start + .PHONY: dev-check dev-check: @command -v docker >/dev/null 2>&1 || { \ diff --git a/docs/references/makefile.ja.md b/docs/references/makefile.ja.md index 600ba32..33a7f34 100644 --- a/docs/references/makefile.ja.md +++ b/docs/references/makefile.ja.md @@ -116,6 +116,8 @@ make run-logs | `make install-tq-prerelease` | 最新の prerelease から `tq` と管理対象サービスの実行ファイルをインストールします。`gh` が必要です。 | | `make install-tq-prerelease version=v0.1.0-pre.1` | 特定の prerelease タグから `tq` と管理対象サービスの実行ファイルをインストールします。 | | `make build-tq-dev` | `dev` profile を埋め込んだ `tqdev` バイナリをカレントディレクトリに build します。 | +| `make deploy-tq-dev` | `tqdev` のサービスを停止し、`build-tq-dev` を実行して、生成された `tqdev` バイナリを `$HOME/.local/bin` に移動した後、サービスを再起動します。 | +| `make deploy-tq-dev ARGS=/path/to/bin` | 生成された `tqdev` バイナリを `$HOME/.local/bin` の代わりに指定したディレクトリへ配置します。 | タグ、GitHub Actions、GoReleaser を含む全体の流れは [Deployment Flow](../design/deployment.ja.md) を参照してください。 diff --git a/docs/references/makefile.md b/docs/references/makefile.md index 8bd603e..8108937 100644 --- a/docs/references/makefile.md +++ b/docs/references/makefile.md @@ -116,6 +116,8 @@ make run-logs | `make install-tq-prerelease` | Install `tq` and its managed service executables from the latest prerelease. Requires `gh`. | | `make install-tq-prerelease version=v0.1.0-pre.1` | Install `tq` and its managed service executables from a specific prerelease tag. | | `make build-tq-dev` | Build a `tqdev` binary with the `dev` profile in the current directory. | +| `make deploy-tq-dev` | Stop the `tqdev` services, run `build-tq-dev`, move the resulting `tqdev` binary to `$HOME/.local/bin`, and restart the services. | +| `make deploy-tq-dev ARGS=/path/to/bin` | Deploy the resulting `tqdev` binary to the specified directory instead of `$HOME/.local/bin`. | See [Deployment Flow](../design/deployment.md) for the full tag, GitHub Actions, and GoReleaser flow.