-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (50 loc) · 1.63 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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 }}