Skip to content

Commit

Permalink
👷 Update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BalconyJH committed Jan 13, 2025
1 parent a35a0f8 commit 7759f1a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 14 deletions.
56 changes: 48 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,68 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., v1.0.0)"
required: true
default: ""

push:
tags:
- v*

jobs:
pypi-publish:
name: upload release to PyPI
name: Upload release to PyPI
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

- uses: pdm-project/setup-pdm@v3
- name: Setup PDM
uses: pdm-project/[email protected]
with:
python-version: 3.9

- name: Publish package distributions to PyPI
run: pdm publish
- name: Prepare pdm environment
run: pdm show --version

- name: Get Version
id: version
run: |
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
INPUT_VERSION="${{ github.event.inputs.version }}"
TAG_VERSION=${{ github.ref_name || '' }}
VERSION=$(pdm show --version)
echo "Debug - Parsed VERSION: $VERSION"
echo "Debug - INPUT_VERSION: $INPUT_VERSION"
echo "Debug - TAG_VERSION: $TAG_VERSION"
if [ -n "$INPUT_VERSION" ]; then
echo "VERSION=$INPUT_VERSION" >> $GITHUB_OUTPUT
echo "TAG_VERSION=${INPUT_VERSION#v}" >> $GITHUB_OUTPUT
else
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "TAG_VERSION=${TAG_VERSION#v}" >> $GITHUB_OUTPUT
fi
- name: Check Version
if: ${{ steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION }}
run: exit 1

- name: Build distribution files
run: pdm build

- name: Publish package distributions to PyPI
run: pdm publish

- name: Publish package to GitHub
run: |
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pip install aioarxiv
* Python 3.9 or higher

## License
[MIT License (c) 2024 BalconyJH ](LICENSE)
[MIT License (c) 2025 BalconyJH ](LICENSE)

## Links
* Documentation for aioarxiv is WIP
Expand Down
3 changes: 2 additions & 1 deletion docs/topics/Installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ at this time:

| **Version** | **Build** | **Release Date** | **Status** | **Notes** |
|-------------|--------------|------------------|------------|-----------------------|
| 0.1.2 | PyPI Release | 15/11/2024 | Latest | Initial testing phase |
| 0.2.0 | PyPI Release | 13/1/2025 | Latest | Initial testing phase |
| 0.1.2 | PyPI Release | 15/11/2024 | Old | Initial testing phase |

## System requirements

Expand Down
15 changes: 11 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,42 @@ line-length = 88
target-version = "py39"

[tool.ruff.lint]
exclude = ["typings/*/"]
select = [
"F", # Pyflakes
"W", # pycodestyle warnings
"E", # pycodestyle errors
"I", # isort
"UP", # pyupgrade
"ASYNC", # flake8-async
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"PLE", # Pylint errors
"NPY", # NumPy-specific rules
"RUF", # Ruff-specific rules
"DTZ", # flake8-datetimez
"SIM", # flake8-simplify
"ISC", # flake8-implicit-str-concat
]
ignore = [
"E402", # module-import-not-at-top-of-file
"UP037", # quoted-annotation
"B008", # function-call-in-default-argument
"RUF001", # ambiguous-unicode-character-string
"RUF002", # ambiguous-unicode-character-docstring
"RUF003", # ambiguous-unicode-character-comment
"ISC001" # single-line-implicit-string-concatenation
]

[tool.ruff.format]
line-ending = "lf"

[tool.ruff.lint.isort]
length-sort = false
force-sort-within-sections = true
known-first-party = ["aioarxiv", "tests/*"]
extra-standard-library = ["typing_extensions"]
Expand Down

0 comments on commit 7759f1a

Please sign in to comment.