-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (54 loc) · 1.73 KB
/
Copy pathrelease_package.yml
File metadata and controls
70 lines (54 loc) · 1.73 KB
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
63
64
65
66
67
68
69
70
name: Sync Version and Publish
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Switch to main
run: |
git fetch origin main
git checkout main
- name: Update version from tag
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
python scripts/set_version.py $TAG_NAME
- name: Commit version bump
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add pytest_htmlx/__init__.py
git commit -m "chore: set version from $TAG_NAME" || echo "No changes to commit"
git push origin main
- name: Verify new version
run: grep __version__ pytest_htmlx/__init__.py
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Upload to TestPyPI
run: ./scripts/upload_testpypi.sh
env:
TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Verify install from TestPyPI
run: |
python -m pip install --upgrade pip
pip install --index-url https://test.pypi.org/simple/ --no-deps pytest-htmlx
python -c "import pytest_htmlx; print(pytest_htmlx.__version__)"
- name: Publish to PyPI
run: ./scripts/upload_pypi.sh
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}