Skip to content

Commit a599935

Browse files
authored
chore: add release workflow (#360)
Adds release workflow that (1) creates a GitHub release and (2) publishes built artifacts to PyPI **Release Workflow** 1. Checkout `master` locally and cut a new branch 1. Run `poetry version <rule>` to version bump (e.g., `poetry version patch`) 1. Commit changes and push to remote branch 1. Ensure all quality check workflows pass 1. Explicitly tag PR with `release` label 1. Merge to mainline At this point, a release workflow should be triggered because: * The PR is closed, targeting `master`, and merged * `pyproject.toml` has been detected as modified * The PR had a `release` label The workflow will then proceed to build the artifacts, create a GitHub release with release notes and uploaded artifacts, and publish to PyPI. Example Workflow run: https://github.com/shoelsch/langchain/actions/runs/3711037455/jobs/6291076898 Example Releases: https://github.com/shoelsch/langchain/releases -- Note, this workflow is looking for the `PYPI_API_TOKEN` secret, so that will need to be uploaded to the repository secrets. I tested uploading as far as hitting a permissions issue due to project ownership in Test PyPI.
1 parent 3d43906 commit a599935

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

β€Ž.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: release
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- master
9+
paths:
10+
- 'pyproject.toml'
11+
12+
env:
13+
POETRY_VERSION: "1.3.1"
14+
15+
jobs:
16+
if_release:
17+
if: |
18+
${{ github.event.pull_request.merged == true }}
19+
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Install poetry
24+
run: pipx install poetry==$POETRY_VERSION
25+
- name: Set up Python 3.10
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.10"
29+
cache: "poetry"
30+
- name: Build project for distribution
31+
run: poetry build
32+
- name: Check Version
33+
id: check-version
34+
run: |
35+
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
36+
- name: Create Release
37+
uses: ncipollo/release-action@v1
38+
with:
39+
artifacts: "dist/*"
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
draft: false
42+
generateReleaseNotes: true
43+
tag: v${{ steps.check-version.outputs.version }}
44+
commit: master
45+
- name: Publish to PyPI
46+
env:
47+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
48+
run: |
49+
poetry publish

β€ŽREADME.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ For more information on these concepts, please see our [full documentation](http
5959

6060
## πŸ’ Contributing
6161

62-
As an open source project in a rapidly developing field, we are extremely open
63-
to contributions, whether it be in the form of a new feature, improved infra, or better documentation.
62+
As an open source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infra, or better documentation.
6463

6564
For detailed information on how to contribute, see [here](CONTRIBUTING.md).

0 commit comments

Comments
Β (0)