Add durable settlement to LangChain reserve modes (#49) #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Python package | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "Where to publish" | |
| required: true | |
| default: "testpypi" | |
| type: choice | |
| options: | |
| - testpypi | |
| - pypi | |
| # Default least-privilege; publish-* jobs override with id-token: write. | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build tool | |
| run: python -m pip install --upgrade pip build | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Upload distribution artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| publish-to-testpypi: | |
| name: Publish to TestPyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi' | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/langchain-runcycles | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Download distribution artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.target == 'pypi') | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/langchain-runcycles | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Download distribution artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1 | |
| create-release: | |
| name: Create GitHub Release | |
| needs: publish-to-pypi | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Extract release notes from CHANGELOG | |
| id: notes | |
| run: | | |
| version="${GITHUB_REF_NAME#v}" | |
| # Extract the section between this version's heading and the next "## [" heading. | |
| # Uses string functions instead of regex to stay portable across awk variants. | |
| notes=$(awk -v v="$version" ' | |
| BEGIN { start = "## [" v "]"; flag = 0 } | |
| substr($0, 1, length(start)) == start { flag = 1; next } | |
| substr($0, 1, 4) == "## [" { flag = 0 } | |
| flag { print } | |
| ' CHANGELOG.md) | |
| if [ -z "$(printf '%s' "$notes" | tr -d '[:space:]')" ]; then | |
| echo "::warning::No CHANGELOG entry found for v${version} — using fallback body" | |
| notes="Release v${version}. See commit history for changes." | |
| fi | |
| { | |
| echo "notes<<EOF_GH_OUTPUT" | |
| printf '%s\n' "$notes" | |
| echo "EOF_GH_OUTPUT" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 | |
| with: | |
| name: ${{ github.ref_name }} | |
| body: ${{ steps.notes.outputs.notes }} | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} |