Skip to content

Commit

Permalink
Merge pull request #34 from lindera/publish_crate
Browse files Browse the repository at this point in the history
Publish crate
  • Loading branch information
mosuka authored Dec 5, 2024
2 parents 6e533be + 9841345 commit 409d9d1
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 22 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
target: x86_64
- runner: ubuntu-latest
target: x86
# - runner: ubuntu-latest
# target: aarch64
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
Expand Down Expand Up @@ -215,3 +215,31 @@ jobs:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-crates:
name: Publish crate
strategy:
matrix:
os: [ubuntu-latest]
toolchain: [stable]
needs: [release]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy

- name: Publish lindera-py
run: |
LINDERA_PY_VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="lindera-py") | .version')
LINDERA_PY_VERSIONS=$(curl -s -XGET https://crates.io/api/v1/crates/lindera-py | jq -r 'select(.versions != null) | .versions[].num')
if echo ${LINDERA_PY_VERSIONS} | grep ${LINDERA_PY_VERSION} >/dev/null; then
echo "lindera-py ${LINDERA_PY_VERSION} has already published"
else
cargo publish --token ${{ secrets.CRATES_TOKEN }}
fi
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lindera-py"
version = "0.38.0"
version = "0.38.1"
edition = "2021"
description = "Python binding for Lindera."
documentation = "https://docs.rs/lindera-py"
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DEFAULT_GOAL := build

VERSION := $(shell poetry version -s)
LINDERA_PY_VERSION ?= $(shell cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | select(.name=="lindera-py") | .version')

init:
poetry self add poetry-plugin-export
Expand Down Expand Up @@ -41,6 +42,11 @@ test:
poetry run maturin develop --features=cjk
poetry run pytest -v ./tests

publish:
ifeq ($(shell curl -s -XGET https://crates.io/api/v1/crates/lindera-py | jq -r '.versions[].num' | grep $(LINDERA_PY_VERSION)),)
(cargo package && cargo publish)
endif

tag:
git tag v$(VERSION)
git push origin v$(VERSION)
34 changes: 17 additions & 17 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "lindera"
version = "0.38.0"
version = "0.38.1"
description = ""
authors = ["Minoru Osuka <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 409d9d1

Please sign in to comment.