mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
a5999351cf
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.
50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
name: release
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'pyproject.toml'
|
|
|
|
env:
|
|
POETRY_VERSION: "1.3.1"
|
|
|
|
jobs:
|
|
if_release:
|
|
if: |
|
|
${{ github.event.pull_request.merged == true }}
|
|
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install poetry
|
|
run: pipx install poetry==$POETRY_VERSION
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.10"
|
|
cache: "poetry"
|
|
- name: Build project for distribution
|
|
run: poetry build
|
|
- name: Check Version
|
|
id: check-version
|
|
run: |
|
|
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
|
|
- name: Create Release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
artifacts: "dist/*"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
draft: false
|
|
generateReleaseNotes: true
|
|
tag: v${{ steps.check-version.outputs.version }}
|
|
commit: master
|
|
- name: Publish to PyPI
|
|
env:
|
|
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
|
|
run: |
|
|
poetry publish
|