diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 446a881..e09e4d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,6 +78,12 @@ jobs: - name: Install frontend dependencies run: pnpm install + - name: Bump version from tag + if: startsWith(github.ref, 'refs/tags/') + env: + RELEASE_VERSION: ${{ github.ref_name }} + run: make bump-version + - name: Build and release uses: tauri-apps/tauri-action@v0 env: diff --git a/Cargo.toml b/Cargo.toml index 6d702b8..1c0b0ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,11 @@ members = [ "apps/desktop/src-tauri", ] +[workspace.package] +version = "0.1.0" +edition = "2021" +license = "MIT" + [workspace.dependencies] # shared across all crates serde = { version = "1", features = ["derive"] } diff --git a/Makefile b/Makefile index caf2f63..8d90ea7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,8 @@ -.PHONY: help install dev build build-desktop build-cli test test-parser test-sync cli +.PHONY: help install dev build build-desktop build-cli test test-parser test-sync cli bump-version release + +RELEASE_VERSION ?= +# Strip leading 'v' for version files (v0.2.0 → 0.2.0); evaluated lazily +_VER = $(patsubst v%,%,$(RELEASE_VERSION)) .DEFAULT_GOAL := help @@ -44,3 +48,21 @@ test-parser: ## Run parser unit tests test-sync: ## Run sync + SQLite tests cargo test -p nichinichi-sync + +# ── Release ──────────────────────────────────────────────────────────────────── + +bump-version: ## Update version files from RELEASE_VERSION (RELEASE_VERSION=vX.Y.Z required) + @test -n "$(RELEASE_VERSION)" || (echo "error: RELEASE_VERSION is required, e.g. RELEASE_VERSION=v0.2.0 make bump-version" && exit 1) + sed -i'' -e 's/^version = ".*"/version = "$(_VER)"/' Cargo.toml + cd apps/desktop && npm pkg set version=$(_VER) + cd apps/desktop/src-tauri && \ + tmp=$$(mktemp) && \ + jq '.version = "$(_VER)"' tauri.conf.json > $$tmp && \ + mv $$tmp tauri.conf.json + +release: bump-version ## Bump versions, commit, tag, and push (RELEASE_VERSION=vX.Y.Z required) + cargo check + git add Cargo.toml apps/desktop/package.json apps/desktop/src-tauri/tauri.conf.json + git commit -m "chore: release $(RELEASE_VERSION)" + git tag $(RELEASE_VERSION) + git push origin HEAD $(RELEASE_VERSION) diff --git a/apps/cli/Cargo.toml b/apps/cli/Cargo.toml index f3fb9ee..f1645a9 100644 --- a/apps/cli/Cargo.toml +++ b/apps/cli/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "nichinichi-cli" -version = "0.1.0" -edition = "2021" -license = "MIT" +version.workspace = true +edition.workspace = true +license.workspace = true [[bin]] name = "nichinichi" diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index e75e728..8c80aec 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "nichinichi-desktop" -version = "0.1.0" -edition = "2021" -license = "MIT" +version.workspace = true +edition.workspace = true +license.workspace = true [lib] name = "nichinichi_desktop_lib" diff --git a/crates/ai/Cargo.toml b/crates/ai/Cargo.toml index 182fcee..b1b212b 100644 --- a/crates/ai/Cargo.toml +++ b/crates/ai/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "nichinichi-ai" -version = "0.1.0" -edition = "2021" -license = "MIT" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] nichinichi-types = { workspace = true } diff --git a/crates/parser/Cargo.toml b/crates/parser/Cargo.toml index b13187d..7e9e4a9 100644 --- a/crates/parser/Cargo.toml +++ b/crates/parser/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "nichinichi-parser" -version = "0.1.0" -edition = "2021" -license = "MIT" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] nichinichi-types = { workspace = true } diff --git a/crates/sync/Cargo.toml b/crates/sync/Cargo.toml index 9748b8c..e8c5593 100644 --- a/crates/sync/Cargo.toml +++ b/crates/sync/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "nichinichi-sync" -version = "0.1.0" -edition = "2021" -license = "MIT" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] nichinichi-types = { workspace = true } diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index bb41836..1c54401 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "nichinichi-types" -version = "0.1.0" -edition = "2021" -license = "MIT" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] serde = { workspace = true }