2023-01-16 02:35:21 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
2023-07-21 16:20:24 +00:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
working-directory:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
description: "From which folder this pipeline executes"
|
2023-01-16 02:35:21 +00:00
|
|
|
|
|
|
|
env:
|
2023-08-21 14:35:56 +00:00
|
|
|
POETRY_VERSION: "1.5.1"
|
2023-01-16 02:35:21 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
if_release:
|
2023-08-21 16:57:40 +00:00
|
|
|
# Disallow publishing from branches that aren't `master`.
|
|
|
|
if: github.ref == 'refs/heads/master'
|
2023-01-16 02:35:21 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-08-21 18:44:29 +00:00
|
|
|
permissions:
|
|
|
|
# This permission is used for trusted publishing:
|
|
|
|
# https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
|
|
|
|
#
|
|
|
|
# Trusted publishing has to also be configured on PyPI for each package:
|
|
|
|
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
|
|
|
|
id-token: write
|
2023-08-22 15:38:18 +00:00
|
|
|
|
|
|
|
# This permission is needed by `ncipollo/release-action` to create the GitHub release.
|
|
|
|
contents: write
|
2023-07-21 16:20:24 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ${{ inputs.working-directory }}
|
2023-01-16 02:35:21 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-08-28 14:20:48 +00:00
|
|
|
|
|
|
|
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
|
|
|
|
uses: "./.github/actions/poetry_setup"
|
2023-01-16 02:35:21 +00:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
2023-08-28 14:20:48 +00:00
|
|
|
poetry-version: ${{ env.POETRY_VERSION }}
|
|
|
|
working-directory: ${{ inputs.working-directory }}
|
|
|
|
cache-key: release
|
|
|
|
|
2023-01-16 02:35:21 +00:00
|
|
|
- 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
|
2023-07-29 00:16:51 +00:00
|
|
|
if: ${{ inputs.working-directory == 'libs/langchain' }}
|
2023-01-16 02:35:21 +00:00
|
|
|
with:
|
|
|
|
artifacts: "dist/*"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
draft: false
|
|
|
|
generateReleaseNotes: true
|
|
|
|
tag: v${{ steps.check-version.outputs.version }}
|
|
|
|
commit: master
|
2023-08-21 18:44:29 +00:00
|
|
|
- name: Publish package distributions to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
with:
|
|
|
|
packages-dir: ${{ inputs.working-directory }}/dist/
|
|
|
|
verbose: true
|
|
|
|
print-hash: true
|