diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml new file mode 100644 index 0000000..24030af --- /dev/null +++ b/.github/workflows/bump.yml @@ -0,0 +1,73 @@ +name: Bump Version + +on: + workflow_dispatch: + inputs: + bump: + description: "Version bump type" + required: true + type: choice + options: + - patch + - minor + - major + + workflow_call: + inputs: + bump: + required: true + type: string + +jobs: + bump: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install tomato-toml + run: cargo install tomato-toml --locked + + - name: Calculate next version + id: version + run: | + current=$(tomato get workspace.package.version Cargo.toml) + IFS='.' read -r major minor patch <<< "$current" + case "${{ inputs.bump }}" in + major) next="$((major + 1)).0.0" ;; + minor) next="$major.$((minor + 1)).0" ;; + patch) next="$major.$minor.$((patch + 1))" ;; + esac + echo "current=$current" >> "$GITHUB_OUTPUT" + echo "next=$next" >> "$GITHUB_OUTPUT" + + - name: Bump versions + run: | + next="${{ steps.version.outputs.next }}" + tomato set workspace.package.version "$next" Cargo.toml + tomato set workspace.dependencies.plotnik-core.version "$next" Cargo.toml + tomato set workspace.dependencies.plotnik-langs.version "$next" Cargo.toml + tomato set workspace.dependencies.plotnik-lib.version "$next" Cargo.toml + # plotnik-cli has explicit plotnik-langs dep (default-features = false workaround) + tomato set dependencies.plotnik-langs.version "$next" crates/plotnik-cli/Cargo.toml + + - name: Update lockfile + run: cargo check --workspace + + - name: Create PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + next="${{ steps.version.outputs.next }}" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b "bump/v$next" + git add Cargo.toml Cargo.lock crates/plotnik-cli/Cargo.toml + git commit -m "chore: Bump version to \`$next\`" + git push -u origin "bump/v$next" + gh pr create \ + --title "chore: Bump version to \`$next\`" \ + --body "Bump ${{ inputs.bump }} version: \`${{ steps.version.outputs.current }}\` → \`$next\`" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0b779c..5318bbc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,8 @@ name: release on: - push: - tags: - - "v[0-9]+.*" + release: + types: [published] env: CARGO_TERM_COLOR: always @@ -37,6 +36,7 @@ jobs: publish: needs: verify runs-on: ubuntu-latest + environment: crates-io steps: - name: Checkout uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 @@ -49,16 +49,11 @@ jobs: with: registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} - github-release: + bump-patch: needs: publish - runs-on: ubuntu-latest + uses: ./.github/workflows/bump.yml + with: + bump: patch permissions: contents: write - steps: - - name: Checkout - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - - - name: Create GitHub Release - uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 - with: - generate_release_notes: true + pull-requests: write diff --git a/Cargo.lock b/Cargo.lock index 15ba56c..dfb4f20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1366,7 +1366,7 @@ checksum = "6738d2e996274e499bc7b0d693c858b7720b9cd2543a0643a3087e6cb0a4fa16" dependencies = [ "cfg-if", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1400,7 +1400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1868,7 +1868,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1996,7 +1996,7 @@ dependencies = [ "getrandom", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ed38b53..37d4b51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,14 @@ [workspace] - resolver = "2" - members = ["crates/plotnik-cli", "crates/plotnik-lib", "crates/plotnik-langs", "crates/plotnik-core"] + +[workspace.package] +version = "0.2.0" +license = "Apache-2.0" +repository = "https://github.com/plotnik-lang/plotnik" +edition = "2024" + +[workspace.dependencies] +plotnik-core = { path = "crates/plotnik-core", version = "0.2.0" } +plotnik-langs = { path = "crates/plotnik-langs", version = "0.2.0" } +plotnik-lib = { path = "crates/plotnik-lib", version = "0.2.0" } diff --git a/crates/plotnik-cli/Cargo.toml b/crates/plotnik-cli/Cargo.toml index 146dffc..4cb4a05 100644 --- a/crates/plotnik-cli/Cargo.toml +++ b/crates/plotnik-cli/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "plotnik" -version = "0.2.0" -edition = "2024" -license = "Apache-2.0" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true description = "CLI for plotnik - typed query language for tree-sitter AST" -repository = "https://github.com/plotnik-lang/plotnik" documentation = "https://docs.rs/plotnik" keywords = ["tree-sitter", "query", "ast", "parser", "cli"] categories = ["command-line-utilities", "development-tools"] @@ -234,9 +234,9 @@ lang-zsh = ["plotnik-langs/lang-zsh"] [dependencies] clap = { version = "4.5", features = ["derive"] } -plotnik-core = { version = "0.2", path = "../plotnik-core" } -plotnik-langs = { version = "0.2", path = "../plotnik-langs", default-features = false } -plotnik-lib = { version = "0.2", path = "../plotnik-lib" } +plotnik-core.workspace = true +plotnik-langs = { path = "../plotnik-langs", version = "0.2.0", default-features = false } +plotnik-lib.workspace = true arborium-tree-sitter = "2.5.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/crates/plotnik-core/Cargo.toml b/crates/plotnik-core/Cargo.toml index 3a88bfd..12f0edc 100644 --- a/crates/plotnik-core/Cargo.toml +++ b/crates/plotnik-core/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "plotnik-core" -version = "0.2.0" -edition = "2024" -license = "Apache-2.0" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true description = "Core data structures for Plotnik" -repository = "https://github.com/plotnik-lang/plotnik" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } diff --git a/crates/plotnik-langs/Cargo.toml b/crates/plotnik-langs/Cargo.toml index d770d14..289b434 100644 --- a/crates/plotnik-langs/Cargo.toml +++ b/crates/plotnik-langs/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "plotnik-langs" -version = "0.2.0" -edition = "2024" -license = "Apache-2.0" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true description = "Tree-sitter language bindings for Plotnik query language" -repository = "https://github.com/plotnik-lang/plotnik" documentation = "https://docs.rs/plotnik-langs" keywords = ["tree-sitter", "parser", "languages"] categories = ["parsing", "development-tools"] @@ -233,7 +233,7 @@ lang-zsh = ["dep:arborium-zsh"] [dependencies] paste = "1.0" -plotnik-core = { version = "0.2", path = "../plotnik-core" } +plotnik-core.workspace = true postcard = { version = "1", features = ["alloc"] } arborium-tree-sitter = "2.5.0" arborium-ada = { version = "2.5.0", optional = true } @@ -337,7 +337,7 @@ arborium-zsh = { version = "2.5.0", optional = true } [build-dependencies] cargo_metadata = "0.23" -plotnik-core = { version = "0.2", path = "../plotnik-core" } +plotnik-core.workspace = true postcard = { version = "1", features = ["alloc"] } serde = "1" serde_json = "1" diff --git a/crates/plotnik-lib/Cargo.toml b/crates/plotnik-lib/Cargo.toml index 4138c0c..44e3331 100644 --- a/crates/plotnik-lib/Cargo.toml +++ b/crates/plotnik-lib/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "plotnik-lib" -version = "0.2.0" -edition = "2024" -license = "Apache-2.0" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true description = "Typed query language for tree-sitter AST" -repository = "https://github.com/plotnik-lang/plotnik" documentation = "https://docs.rs/plotnik-lib" readme = "../../README.md" keywords = ["tree-sitter", "query", "ast", "parser"] @@ -23,8 +23,8 @@ thiserror = "2.0.17" arborium-tree-sitter = "2.5.0" crc32fast = "1.4" memmap2 = "0.9" -plotnik-core = { version = "0.2", path = "../plotnik-core" } -plotnik-langs = { version = "0.2", path = "../plotnik-langs", optional = true } +plotnik-core.workspace = true +plotnik-langs = { workspace = true, optional = true } [features] default = ["plotnik-langs"]