Skip to content

Commit

Permalink
Merge pull request #140 from kurusugawa-computer/introduce-dynamic-ve…
Browse files Browse the repository at this point in the history
…rsioning

`poetry-dynamic-versioning`を導入して、GitHubのバージョンタグからバージョンを動的に生成するようにしました。
  • Loading branch information
seraphr committed Aug 26, 2024
2 parents ccc5021 + 9d3e64b commit 1f7e5af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install poetry
run: |
python -m pip install "poetry==1.1.15"
python -m pip install "poetry==1.8.3"
poetry self add "poetry-dynamic-versioning[plugin]@1.4.0"
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,13 @@ poetry completions bash | sudo tee /etc/bash_completion.d/poetry.bash-completion
## PyPIへの公開
[GitHubのReleases](https://github.com/kurusugawa-computer/annofab-3dpc-editor-cli/releases)からリリースを作成してください。
GitHub Actionsにより自動でPyPIに公開されます。
バージョン情報は、`poetry build`時に[poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning)によって、Gitのバージョンタグから生成されます。

手動でPyPIに公開する場合は、以下のコマンドを実行してください。

```
# VSCode Dev Containersでは、`/usr/local/lib/python3.12/dist-packages/`にインストールしようとするため、`sudo`で実行する必要があります。
$ sudo poetry self add "poetry-dynamic-versioning[plugin]@1.4.0"
$ make publish
```

Expand Down
2 changes: 1 addition & 1 deletion anno3d/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.2a1"
__version__ = "0.0.0" # `poetry-dynamic-versioning`を使ってGitHubのバージョンタグを取得している。変更不要
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "annofab-3dpc-editor-cli"
version = "0.2.2a1"
version = "0.0.0" # `poetry-dynamic-versioning`を使ってGitHubのバージョンタグを取得している。変更不要
description = "Annofabの3次元プロジェクトを操作するためのCLIです。"
authors = ["Kurusugawa Computer Inc."]
repository="https://github.com/kurusugawa-computer/annofab-3dpc-editor-cli"
Expand Down Expand Up @@ -63,6 +63,10 @@ multi_line_output = 3
[tool.poetry.scripts]
anno3d = "anno3d.app:main"

[tool.poetry-dynamic-versioning]
enable = true


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

0 comments on commit 1f7e5af

Please sign in to comment.