Repository navigation
76 lines (67 loc) · 2.46 KB
/
Copy pathpublish.yml
File metadata and controls
76 lines (67 loc) · 2.46 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
# Publishes one package to PyPI with trusted publishing (no API token).
#
# git tag bhived-v0.1.0 && git push origin bhived-v0.1.0
# git tag langchain-bhived-v0.1.0 && git push origin langchain-bhived-v0.1.0
# git tag strands-bhived-v0.1.0 && git push origin strands-bhived-v0.1.0
# git tag agent-framework-bhived-v0.1.0 && git push origin agent-framework-bhived-v0.1.0
#
# The tag version must match the package's _version.py, or the job stops.
name: Publish
on:
push:
tags:
- "bhived-v*"
- "langchain-bhived-v*"
- "strands-bhived-v*"
- "agent-framework-bhived-v*"
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Pick the package from the tag
id: pkg
env:
TAG: ${{ github.ref_name }}
run: |
case "$TAG" in
langchain-bhived-v*) dir=packages/langchain-bhived; wheel=langchain_bhived; version="${TAG#langchain-bhived-v}" ;;
strands-bhived-v*) dir=packages/strands-bhived; wheel=strands_bhived; version="${TAG#strands-bhived-v}" ;;
agent-framework-bhived-v*) dir=packages/agent-framework-bhived; wheel=agent_framework_bhived; version="${TAG#agent-framework-bhived-v}" ;;
bhived-v*) dir=packages/bhived; wheel=bhived; version="${TAG#bhived-v}" ;;
*) echo "Unknown tag $TAG"; exit 1 ;;
esac
echo "dir=$dir" >> "$GITHUB_OUTPUT"
echo "wheel=$wheel" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Test
run: |
python -m pip install -r requirements-dev.txt
python -m pytest
- name: Build
run: |
python -m pip install build
python -m build "${{ steps.pkg.outputs.dir }}" --outdir dist
- name: Check the tag matches the package version
run: test -f "dist/${{ steps.pkg.outputs.wheel }}-${{ steps.pkg.outputs.version }}-py3-none-any.whl"
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1