diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-03-20 21:12:32 -0400 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-03-21 13:37:31 -0400 |
| commit | 91054e89cd96df335a754acba757a7f13880f690 (patch) | |
| tree | e9ee9053a6ab5c6bf81fb1ba4499c1c8cf487217 | |
| parent | Fix subprocess signal handling logic on linux with ash/dash (diff) | |
| download | taskipy2-91054e89cd96df335a754acba757a7f13880f690.zip | |
Add pypi publish job and release commit script
| -rw-r--r-- | .builds/release.yml | 22 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 25 | ||||
| -rw-r--r-- | .github/workflows/windows.yml | 28 | ||||
| -rwxr-xr-x | scripts/publish-to-pypi.sh | 39 | ||||
| -rwxr-xr-x | scripts/release-commit.sh | 39 |
5 files changed, 100 insertions, 53 deletions
diff --git a/.builds/release.yml b/.builds/release.yml new file mode 100644 index 0000000..22181b0 --- /dev/null +++ b/.builds/release.yml @@ -0,0 +1,22 @@ +image: alpine/3.23 +submitter: + git.sr.ht: + enabled: true + allow-refs: + - "refs/tags/*" +triggers: + - action: email + condition: failure + to: builds@eugenetriguba.com +secrets: + - 7e447af3-be10-4abf-8a6f-d6fd2cf7e173 +packages: + - uv +sources: + - https://git.sr.ht/~eugenetriguba/taskipy2 +tasks: + - release: | + cd taskipy2 + set +x + TOKEN=$(cat ~/.pypi-token) + ./scripts/publish-to-pypi.sh --token "$TOKEN" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 19212b7..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Release Python Package - -on: - release: - types: - - published - -jobs: - release: - runs-on: ubuntu-22.04 - environment: Release - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.12' - - name: Install dependencies - run: pip install setuptools==68.2.2 wheel==0.41.3 poetry==1.7.1 - - name: Build and publish - run: | - poetry build - poetry publish - env: - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 980d0bd..0000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This workflow checks that windows paths (a\b\c) work correctly when -# passed as args to taskipy and that mslex is installed. - -name: Taskipy Windows Tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Install Poetry - run: | - python -m pip install --upgrade pip - pip install poetry - - name: Install dependencies - run: poetry install - - name: Test Windows - run: poetry run task test_windows diff --git a/scripts/publish-to-pypi.sh b/scripts/publish-to-pypi.sh new file mode 100755 index 0000000..c779419 --- /dev/null +++ b/scripts/publish-to-pypi.sh @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +PYPI_TOKEN="" + +main() { + parse_args "$@" + uv build + uv publish --token "$PYPI_TOKEN" +} + +usage() { + echo "Usage: $0 [-h|--help] -t|--token TOKEN" + echo "" + echo "Options:" + echo " -h, --help Show this help message and exit" + echo " -t, --token Required PyPI token for publishing the package" +} + +parse_args() { + while [ $# -gt 0 ]; do + case "$1" in + -h | --help) + usage + exit 0 + ;; + -t | --token) + PYPI_TOKEN="$2" + shift 2 + ;; + *) + usage + exit 1 + ;; + esac + done +} + +main "$@" diff --git a/scripts/release-commit.sh b/scripts/release-commit.sh new file mode 100755 index 0000000..be43d8b --- /dev/null +++ b/scripts/release-commit.sh @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +main() { + if [ $# -ne 1 ]; then + echo "Usage: $0 <version>" + exit 1 + fi + + VERSION="$1" + DATE=$(date +%Y-%m-%d) + + sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml + sed -i "s/^## \[Unreleased\]/## [$VERSION] - $DATE/" CHANGELOG.md + + git add pyproject.toml CHANGELOG.md + git commit -m "Release version v$VERSION" + git tag "$VERSION" + + git show HEAD + echo "" + git log --oneline -5 + echo "" + + printf "Push commit and tag v%s? [y/N] " "$VERSION" + read -r CONFIRM + case "$CONFIRM" in + [yY]) ;; + *) + echo "Aborted." + exit 1 + ;; + esac + + git push + git push origin "$VERSION" +} + +main "$@" |