File tree Expand file tree Collapse file tree 4 files changed +108
-0
lines changed
Expand file tree Collapse file tree 4 files changed +108
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ name : create_tag
3+
4+ ' on ' :
5+ workflow_dispatch :
6+ push :
7+ branches :
8+ - master
9+
10+ jobs :
11+ create_tag :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+ with :
18+ token : ${{secrets.PUSH_TOKEN}}
19+
20+ - name : Set up Python
21+ uses : actions/setup-python@v5
22+ with :
23+ python-version : 3.11
24+
25+ - name : Set up Poetry
26+ uses : snok/install-poetry@v1
27+
28+ - name : Tag and push
29+ run : |
30+ ./create_tag.sh
31+ ...
Original file line number Diff line number Diff line change 1+ ---
2+ name : publish
3+
4+ ' on ' :
5+ workflow_dispatch :
6+ release :
7+ types :
8+ - created
9+
10+ jobs :
11+ publish :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Python
19+ uses : actions/setup-python@v5
20+ with :
21+ python-version : 3.11
22+
23+ - name : Set up Poetry
24+ uses : snok/install-poetry@v1
25+
26+ - name : Publish to PyPi
27+ env :
28+ POETRY_PYPI_TOKEN_PYPI : ${{ secrets.PYPI_TOKEN }}
29+ run : poetry publish --build
30+ ...
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ if [[ " $# " -ne 1 ]]; then
6+ echo " Provide one argument."
7+ exit 1
8+ fi
9+
10+ VERSION_ARG=$1
11+ readonly VERSION_ARG
12+
13+ poetry version " ${VERSION_ARG} "
14+
15+
16+ NEW_VERSION=$( poetry version --short)
17+ readonly NEW_VERSION
18+
19+ git add pyproject.toml
20+ git commit -m " chore: bump version to \` ${NEW_VERSION} \` "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ current_branch=$( git branch --show-current)
6+ readonly current_branch
7+ if [[ " ${current_branch} " != " master" ]]; then
8+ echo " You are not on the master."
9+ exit 1
10+ fi
11+
12+ current_version=$( poetry version --short)
13+ readonly current_version
14+ if [[ -z " ${current_version} " ]]; then
15+ echo " Failed to get the current version from poetry."
16+ exit 1
17+ fi
18+
19+ tag_name=" v${current_version} "
20+ readonly tag_name
21+ if git ls-remote --tags origin | grep " refs/tags/${tag_name} " ; then
22+ echo " Tag ${tag_name} already exists."
23+ exit 0
24+ fi
25+
26+ git tag " ${tag_name} "
27+ git push origin tag " ${tag_name} "
You can’t perform that action at this time.
0 commit comments