rename fast_cache to ultra_cache, update CI #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Python package to PyPI | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
name: Set up Python 3.12 | |
with: | |
python-version: '3.12' | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Get version from pyproject.toml | |
id: get_version | |
run: | | |
VERSION=$(poetry version -s) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Check if tag exists | |
id: check_tag | |
run: | | |
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then | |
echo "tag_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "tag_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Create tag and release | |
if: steps.check_tag.outputs.tag_exists == 'false' | |
run: | | |
git tag "v${{ env.VERSION }}" | |
git push origin "v${{ env.VERSION }}" | |
gh release create "v${{ env.VERSION }}" --title "v${{ env.VERSION }}" --notes "Release version ${{ env.VERSION }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |