Skip to content

Commit 95bf78b

Browse files
up automaion and settings
1 parent 863ab62 commit 95bf78b

File tree

3 files changed

+101
-1
lines changed

3 files changed

+101
-1
lines changed

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release (TestPyPI only)
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
packages: write
12+
13+
jobs:
14+
build:
15+
name: Build distributions
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
cache: 'pip'
23+
- name: Install build tooling
24+
run: |
25+
python -m pip install -U pip build twine
26+
- name: Build sdist/wheel
27+
run: |
28+
python -m build
29+
python -m twine check dist/*
30+
- name: Upload artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: dist
34+
path: dist/*
35+
36+
publish-testpypi:
37+
name: Publish to TestPyPI
38+
needs: [build]
39+
runs-on: ubuntu-latest
40+
if: contains(github.ref_name, '-')
41+
steps:
42+
- uses: actions/download-artifact@v4
43+
with:
44+
name: dist
45+
path: dist
46+
- name: Publish to TestPyPI
47+
uses: pypa/[email protected]
48+
with:
49+
repository-url: https://test.pypi.org/legacy/
50+
verbose: true
51+
env:
52+
PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
53+
54+
publish-pypi:
55+
name: Publish to PyPI
56+
needs: [build]
57+
runs-on: ubuntu-latest
58+
if: ${{ !contains(github.ref_name, '-') }}
59+
steps:
60+
- uses: actions/download-artifact@v4
61+
with:
62+
name: dist
63+
path: dist
64+
- name: Publish to PyPI
65+
uses: pypa/[email protected]
66+
with:
67+
verbose: true
68+
env:
69+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
70+
71+
github-release:
72+
name: Create GitHub Release
73+
# depend on both publish jobs so we can inspect their outcome
74+
needs: [publish-testpypi, publish-pypi]
75+
runs-on: ubuntu-latest
76+
# only run when the relevant publish job succeeded for the tag type:
77+
if: >-
78+
(contains(github.ref_name, '-') && needs.publish-testpypi.result == 'success') ||
79+
(!contains(github.ref_name, '-') && needs.publish-pypi.result == 'success')
80+
steps:
81+
- uses: actions/download-artifact@v4
82+
with:
83+
name: dist
84+
path: dist
85+
- name: Create Release
86+
uses: softprops/action-gh-release@v2
87+
with:
88+
tag_name: ${{ github.ref_name }}
89+
name: ${{ github.ref_name }}
90+
body: |
91+
Automated release for ${{ github.ref_name }}.
92+
draft: false
93+
prerelease: ${{ contains(github.ref_name, '-') }}
94+
files: |
95+
dist/*.whl
96+
dist/*.tar.gz

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
## 0.1.2 - 2025-10-19
6+
- Clarified documentation
7+
- Add GH action for auto-release
8+
59
## 0.1.1 - 2025-10-18
610
- Minor improvements of examples, documentation, settings. First deployment to PyPi.
711

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
55
[project]
66
name = "python-project-template-AS"
77
description = "A minimal Python project demonstrating best practices for testing, documentation, and CI/CD. It implements a mini calculator as a minimal example."
8-
version = "0.1.1"
8+
version = "0.1.2"
99
readme = "README.md"
1010
requires-python = ">=3.8"
1111
authors = [{ name = "Andrea Scaglioni", email = "[email protected]" }]

0 commit comments

Comments
 (0)