Skip to content

Merge pull request #177 from Olen/Olen-patch-1 #2

Merge pull request #177 from Olen/Olen-patch-1

Merge pull request #177 from Olen/Olen-patch-1 #2

Workflow file for this run

name: Release to PyPI
on:
push:
branches:
- main # Adjust if your default branch is different
paths:
- 'pyproject.toml'
permissions:
id-token: write # Required for OIDC authentication
contents: read
jobs:
release:
name: 🎯 Create Release & Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: πŸ›ŽοΈ Checkout repository
uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: 🎭 Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: πŸ—οΈ Install project
# Don't install dependencies that are handled within actions
run: poetry install --without dev-not-ci
- name: πŸ” Extract version from Poetry
id: get_version
run: |
VERSION=$(poetry version -s)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "πŸ”’ Extracted version: $VERSION"
- name: πŸ” Check if Git tag exists
id: check_tag
run: |
if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
echo "⚠️ Tag v${VERSION} already exists. Skipping release!"
exit 1
fi
- name: "πŸ—οΈ Get previous release version"
id: last_release
uses: InsonusK/[email protected]
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
- name: "🏷️ Create new tag"
uses: rickstaa/action-create-tag@v1
id: "tag_create"
with:
tag: "v${{ VERSION }}"

Check failure on line 65 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / Release to PyPI

Invalid workflow file

The workflow is not valid. .github/workflows/release.yml (Line: 65, Col: 16): Unrecognized named-value: 'VERSION'. Located at position 1 within expression: VERSION .github/workflows/release.yml (Line: 67, Col: 20): Unrecognized named-value: 'VERSION'. Located at position 1 within expression: VERSION
tag_exists_error: false
message: "βœ… Tag Version v${{ VERSION }} created"
- name: "πŸ—’οΈ Generate release changelog"
id: changelog
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: ${{ steps.last_release.outputs.tag_name }}
headerLabel: "# Notable changes since ${{ steps.last_release.outputs.tag_name }}"
stripGeneratorNotice: true
- name: πŸš€ Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: πŸŽ‰ Release v${{ env.VERSION }}
body: "πŸš€ Automated release of version **v${{ env.VERSION }}**"
draft: false
prerelease: false
- name: πŸ—οΈ Build package with Poetry
run: poetry build
- name: πŸš€ Publish to PyPI with OpenID
uses: pypa/gh-action-pypi-publish@release/v1