Skip to content

Publish Package & Release #15

Publish Package & Release

Publish Package & Release #15

Workflow file for this run

name: Publish Package & Release
on:
push:
tags:
- '*'
branches:
- dev
workflow_run:
workflows: [ "Checks" ]
types:
- completed
jobs:
publish-to-pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
if: github.repository == 'ahmedwelhakim/django-webpfield'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install pypa/build
run: |
python -m pip install -U pip
python -m pip install -U build hatchling twine
- name: Build a binary wheel and a source tarball
run: |
hatchling version
python -m build
twine check dist/*
- name: Adding dev to the version number if in dev branch
if: github.ref == 'refs/heads/dev'
run: hatchling version dev
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@master
if: github.ref == 'refs/heads/dev'
continue-on-error: true
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Getting the version from tags
if: startsWith(github.ref, 'refs/tags')
run: hatchling version ${GITHUB_REF#refs/tags/}
continue-on-error: true
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}