-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.28 KB
/
pypi_test.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
name: PyPi distribute test push
on: [push]
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Create test version tag
run: |
# Get number of commits in current branch
COMMIT_COUNT=$(git rev-list --count HEAD)
# Get short SHA
SHA=$(git rev-parse --short HEAD)
# Create a PEP 440 compliant version number
VERSION="0.2.1.dev${COMMIT_COUNT}"
# Create and push tag
git tag -a "v${VERSION}" -m "Test release ${VERSION}"
echo "Created tag v${VERSION}"
- name: Install Hatch
run: pip install hatch
- name: Build
run: hatch build
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/