Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -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\`"
21 changes: 8 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: release

on:
push:
tags:
- "v[0-9]+.*"
release:
types: [published]

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -37,6 +36,7 @@ jobs:
publish:
needs: verify
runs-on: ubuntu-latest
environment: crates-io
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
Expand All @@ -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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
14 changes: 7 additions & 7 deletions crates/plotnik-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions crates/plotnik-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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)'] }
Expand Down
12 changes: 6 additions & 6 deletions crates/plotnik-langs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions crates/plotnik-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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"]
Expand Down