-
Notifications
You must be signed in to change notification settings - Fork 4
132 lines (110 loc) · 3.62 KB
/
Copy pathpublish.yml
File metadata and controls
132 lines (110 loc) · 3.62 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: release
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit
release:
runs-on: ubuntu-latest
needs: test
environment: PyPi
outputs:
released: ${{ steps.release.outputs.released }}
tag: ${{ steps.release.outputs.tag }}
permissions:
contents: write
steps:
- name: Generate token for version incrementer app
id: create_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Setup | Checkout Repository on Release Branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
token: ${{ steps.create_token.outputs.token }}
- name: Sync to latest remote
run: |
git fetch --prune origin
git checkout ${{ github.ref_name }}
git merge --ff-only origin/${{ github.ref_name }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install dependencies
run: |
uv sync
- name: Action | Semantic Version Release
id: release
uses: python-semantic-release/python-semantic-release@v10.4.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
commit: "false"
push: "false"
tag: "false"
changelog: "true"
vcs_release: "false"
- name: Commit and push version changes
if: steps.release.outputs.released == 'true'
run: |
git config user.name "github-actions"
git config user.email "actions@users.noreply.github.com"
uv lock
git add pyproject.toml CHANGELOG.md uv.lock
git commit -m "${{ steps.release.outputs.tag }}
Automatically generated by python-semantic-release"
git tag ${{ steps.release.outputs.tag }}
git push origin ${{ github.ref_name }} --tags
- name: Create GitHub Release
if: steps.release.outputs.released == 'true'
run: |
gh release create ${{ steps.release.outputs.tag }} \
--title "${{ steps.release.outputs.tag }}" \
--generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@v10.4.1
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
- name: Upload | Distribution Artifacts
if: steps.release.outputs.released == 'true'
uses: actions/upload-artifact@v4
with:
name: distribution-artifacts
path: dist
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
environment: PyPi
needs: release
if: ${{ needs.release.outputs.released == 'true' }}
permissions:
contents: read
id-token: write
steps:
- name: Setup | Download Build Artifacts
uses: actions/download-artifact@v4
id: artifact-download
with:
name: distribution-artifacts
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/