-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (62 loc) · 1.81 KB
/
Copy pathpublish.yml
File metadata and controls
67 lines (62 loc) · 1.81 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
name: Publish
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
check-version:
name: Version Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Verify tag matches package version
env:
TAG: ${{ github.ref_name }}
run: |
TAG_VERSION="${TAG#v}"
PKG_VERSION=$(python3 -c "
import re
with open('pyproject.toml') as f:
for line in f:
m = re.match(r'^version\s*=\s*\"(.+)\"', line)
if m:
print(m.group(1))
break
")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)"
exit 1
fi
echo "Version check passed: $TAG_VERSION"
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- ci
- check-version
permissions:
id-token: write
contents: write
environment:
name: pypi
url: https://pypi.org/p/dotsman
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Build package
run: uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: gh release create "$TAG" dist/* --generate-notes