Skip to content

Debugging

Debugging #6

Workflow file for this run

name: Publish Python Package
on:
push:
branches:
- fix/add-publish-package-workflow
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
build-and-publish:
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 dependencies
run: |
pip install --upgrade setuptools wheel twine
- name: Extract version from setup.py
id: get_version
run: |
version=$(python -c "import re; print(re.search(r'version=\\'([0-9]+\\.[0-9]+\\.[0-9]+)\\'', open('setup.py').read()).group(1))")
echo "version=$version" >> $GITHUB_ENV
- name: Build wheel
run: |
python setup.py bdist_wheel
- name: Check if Git tag exists
id: check_tag
run: |
if git rev-parse "v${{ env.version }}" >/dev/null 2>&1; then
echo "tag_exists=true" >> $GITHUB_ENV
else
echo "tag_exists=false" >> $GITHUB_ENV
- name: Delete existing Git tag (if exists)
if: env.tag_exists == 'true'
run: |
git tag -d "v${{ env.version }}"
git push origin --delete "v${{ env.version }}"
- name: Create Git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ env.version }}" -m "Release v${{ env.version }}"
git push origin fix/add-publish-package-workflow --tags
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/geoip2fast-${{ env.version }}-py3-none-any.whl