Skip to content

Commit dba08f5

Browse files
chore(TECHOPS-18898): use conventional commits and attach github release assets (#9)
## Overview The changes in this PR use Circle best practices for opensource. * updated the release pipeline to use conventional commits * use release please to manage releases * use github releases, so that repo tags and release assests are configured properly for this repo ## Important Changes for Contributors ⚠️ * contributors should use conventional commit standards for all changes and PR titles moving forward; https://www.conventionalcommits.org/en/v1.0.0/ * release please pipeline will create a seperate PR that much be merged to create a new releas, automatially bump version and publish to pypi: https://github.com/googleapis/release-please
1 parent fd64f61 commit dba08f5

3 files changed

Lines changed: 90 additions & 57 deletions

File tree

.github/workflows/release-test.yml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
1-
name: Test Release
1+
name: Test
22

33
on:
4-
pull_request:
5-
branches:
6-
- master
74
workflow_call:
85

96
jobs:
10-
test:
11-
runs-on: large-spot
12-
steps:
13-
- uses: actions/checkout@v4
7+
test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
1411

15-
- name: Set up Python 3.10
16-
uses: actions/setup-python@v5
17-
with:
18-
python-version: '3.10'
12+
- name: Set up Python 3.10
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.10'
1916

20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
python -m pip install -r requirements.txt
24-
python -m pip install pytest-asyncio
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
python -m pip install -r requirements.txt
21+
python -m pip install pytest pytest-asyncio
2522
26-
- name: Set up build tools
27-
run: |
28-
python -m pip install build
23+
- name: Set up build tools
24+
run: |
25+
python -m pip install build
2926
30-
- name: Install circle-ooak
31-
run: |
32-
python -m build
33-
python -m pip install -e .
27+
- name: Install circle-ooak
28+
run: |
29+
python -m build
30+
python -m pip install -e .
3431
35-
- name: Run tests
36-
run: python -m pytest test/model_unit_test.py
32+
- name: Run tests
33+
run: python -m pytest test/ -v

.github/workflows/release.yml

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,75 @@
1-
name: Release
1+
name: Main Pipeline
22

33
on:
4+
pull_request:
5+
branches: [master]
46
push:
5-
branches:
6-
- master
7+
branches: [master]
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
712

813
jobs:
14+
test:
15+
if: github.event_name == 'pull_request'
16+
uses: ./.github/workflows/release-test.yml
917

10-
test:
11-
uses: ./.github/workflows/release-test.yml
18+
release-please:
19+
if: github.event_name == 'push'
20+
uses: circlefin/circle-public-github-workflows/.github/workflows/conventional-commit-release.yaml@v1
21+
with:
22+
release_type: python
23+
additional_unqualified_tags: true
24+
extra_tags: stable
25+
secrets:
26+
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1227

13-
release:
14-
name: Release
15-
runs-on: large-spot
16-
needs: test
17-
steps:
18-
- uses: actions/checkout@v4
19-
20-
- name: Set up Python
21-
uses: actions/setup-python@v5
22-
with:
23-
python-version: '3.10'
24-
25-
- name: Install build dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
python -m pip install build twine
29-
30-
- name: Build package
31-
run: python -m build
28+
pypi-publish:
29+
name: Publish to PyPI
30+
if: needs.release-please.outputs.release_created == 'true'
31+
needs: release-please
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.10'
3240

33-
- name: Check distribution
34-
run: twine check dist/*
41+
- name: Install build dependencies
42+
run: |
43+
python -m pip install --upgrade pip
44+
python -m pip install build twine
3545
36-
- name: Publish to PyPI
37-
env:
38-
TWINE_USERNAME: __token__
39-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
40-
run: twine upload dist/*
46+
- name: Build package
47+
run: python -m build
48+
49+
- name: Check distribution
50+
run: twine check dist/*
51+
52+
- name: Publish to PyPI
53+
env:
54+
TWINE_USERNAME: __token__
55+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
56+
run: twine upload dist/*
57+
58+
- name: Upload build artifacts for release
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: python-package-distributions
62+
path: dist/
63+
64+
github-release:
65+
name: Create GitHub Release with Assets
66+
if: needs.release-please.outputs.release_created == 'true'
67+
needs: [release-please, pypi-publish]
68+
uses: circlefin/circle-public-github-workflows/.github/workflows/attach-release-assets.yaml@v1
69+
with:
70+
release_tag: ${{ needs.release-please.outputs.release_tag }}
71+
artifact_file_globs: |
72+
*.whl
73+
*.tar.gz
74+
create_manifest: true
75+
generate_sbom: true

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
python-dotenv
2+
openai
23
openai-agents==0.2.6

0 commit comments

Comments
 (0)