-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·70 lines (60 loc) · 2.18 KB
/
release.yml
File metadata and controls
executable file
·70 lines (60 loc) · 2.18 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
# SPDX-FileCopyrightText: 2025 FanaticPythoner
# SPDX-License-Identifier: Apache-2.0
name: Release (tagged)
on:
push:
tags:
- "v*.*.*" # GLOB pattern for SemVer-like tags
permissions:
contents: write
id-token: write # REQUIRED for PyPI Trusted Publishers (OIDC)
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify pyproject version == tag (safety)
shell: bash
run: |
set -euo pipefail
TAG="${{ github.ref_name }}"
TAG_VER="${TAG#v}"
PROJ_VER="$(python -c 'import tomllib; print((tomllib.load(open("pyproject.toml","rb")).get("project") or {}).get("version") or "")')"
if [ -z "${PROJ_VER}" ]; then
echo "ERROR: [project].version missing in pyproject.toml"; exit 2
fi
if [ "${PROJ_VER}" != "${TAG_VER}" ]; then
echo "pyproject.toml version (${PROJ_VER}) != tag (${TAG_VER})"; exit 1
fi
echo "Version OK: ${PROJ_VER} == ${TAG_VER}"
- id: pack
name: Build artifacts
uses: ./.github/actions/build-dist
with:
python_version: "3.12"
- name: Create/Update Release (purge + upload)
uses: ./.github/actions/release-assets
with:
release_tag: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
prerelease: "false"
purge_existing_assets: "true"
create_or_move_tag: "false"
dist_dir: ${{ steps.pack.outputs.dist_dir }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ${{ steps.pack.outputs.dist_dir }}
# Force a hard error if the version already exists,
# so we never "succeed" without uploading.
skip-existing: false
print-hash: true