forked from htkuan/ai-agent-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.71 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (75 loc) · 2.71 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
name: Release
# Runs on every push to main. python-semantic-release inspects the
# Conventional Commits since the last v* tag, decides the next version,
# bumps pyproject.toml, writes CHANGELOG.md, tags, and creates a GitHub
# Release. If (and only if) a release was cut, the deploy job uploads the
# built distributions to PyPI via Trusted Publishing (OIDC, no secrets).
#
# Pushes made with GITHUB_TOKEN do not re-trigger workflows, so the version
# bump commit PSR pushes back to main will not cause a loop.
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: write # push the version bump commit + tag, create the GitHub Release
outputs:
released: ${{ steps.release.outputs.released || 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # PSR needs full history + tags to compute the version
ref: ${{ github.ref_name }}
- name: Pin release branch to the triggering commit
run: git reset --hard ${{ github.sha }}
- name: Semantic version release
id: release
# Pinned to a known-good tag; bump to the latest v10.x as needed.
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
- name: Attach distributions to the GitHub Release
if: steps.release.outputs.released == 'true'
uses: python-semantic-release/publish-action@v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
- name: Upload distributions for the deploy job
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
needs: release
if: ${{ needs.release.outputs.released == 'true' }}
environment:
name: pypi
url: https://pypi.org/p/ai-agent-bridge
permissions:
id-token: write # OIDC token for PyPI Trusted Publishing
steps:
- name: Download built distributions
uses: actions/download-artifact@v4
with:
name: distribution-artifacts
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
print-hash: true