Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 0 additions & 83 deletions .github/workflows/publish-to-pypi.yml

This file was deleted.

119 changes: 119 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# See source with more comments and detailed explanations at:
# https://python-semantic-release.readthedocs.io/en/latest/configuration/automatic-releases/github-actions.html#gh-actions-examples

name: Release

on:
push:
branches:
- main

permissions:
contents: read

jobs:
release:
runs-on: ubuntu-latest
outputs:
released: ${{ steps.release.outputs.released }}
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false

permissions:
contents: write

steps:
- name: Setup | Checkout Repository on Release Branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
token: ${{ secrets.GH_TOKEN_FOR_SEMANTIC_RELEASE }}

- name: Setup | Force release branch to be at workflow sha
run: |
git reset --hard ${{ github.sha }}

- name: Evaluate | Verify upstream has NOT changed
shell: bash
run: |
set +o pipefail

UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | awk -F '\\.\\.\\.' '{print $2}' | cut -d ' ' -f1)"
printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME"

set -o pipefail

if [ -z "$UPSTREAM_BRANCH_NAME" ]; then
printf >&2 '%s\n' "::error::Unable to determine upstream branch name!"
exit 1
fi

git fetch "${UPSTREAM_BRANCH_NAME%%/*}"

if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then
printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!"
exit 1
fi

HEAD_SHA="$(git rev-parse HEAD)"

if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then
printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]"
printf >&2 '%s\n' "::error::Upstream has changed, aborting release..."
exit 1
fi

printf '%s\n' "Verified upstream branch has not changed, continuing with release..."

- name: Action | Semantic Version Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GH_TOKEN_FOR_SEMANTIC_RELEASE }}
git_committer_name: "github-actions"
git_committer_email: "[email protected]"

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/[email protected]
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GH_TOKEN_FOR_SEMANTIC_RELEASE }}
tag: ${{ steps.release.outputs.tag }}

- name: Upload | Distribution Artifacts
uses: actions/upload-artifact@v4
if: steps.release.outputs.released == 'true'
with:
name: distribution-artifacts
path: dist
if-no-files-found: error

deploy:
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.released == 'true' }}

permissions:
contents: read
id-token: write

environment:
name: pypi
url: https://pypi.org/p/langchain-linkup

steps:
- name: Setup | Download Build Artifacts
uses: actions/download-artifact@v4
id: artifact-download
with:
name: distribution-artifacts
path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
print-hash: true
verbose: true
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"] # Only test minimal supported version and maximal stable version
python-version: ["3.10", "3.14"] # Min and max supported versions
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ repos:
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
exclude: CHANGELOG.md
- id: trailing-whitespace
exclude: CHANGELOG.md

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CHANGELOG

<!-- version list -->
27 changes: 24 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "A Langchain integration for the Linkup API"
readme = "README.md"
keywords = ["linkup", "api", "langchain", "integration", "search", "retriever"]
license = "MIT"
requires-python = ">=3.9,<4.0"
requires-python = ">=3.10,<4.0"
authors = [
{ name = "LINKUP TECHNOLOGIES", email = "[email protected]" }
]
Expand All @@ -21,10 +21,13 @@ dependencies = [
"linkup-sdk>=0.11.0",
]

[project.optional-dependencies]
build = ["uv>=0.10.0,<0.11.0"] # For python-semantic-release build command, used in GitHub actions

[dependency-groups]
dev = [
"langchain-openai",
"langchain-tests==0.3.4",
"langchain-tests",
"langgraph",
"load-dotenv",
"mypy",
Expand Down Expand Up @@ -57,7 +60,7 @@ exclude_also = ["raise ValueError", "raise TypeError"]

[tool.ruff]
line-length = 100
target-version = "py39"
target-version = "py310"

[tool.ruff.lint]
select = [
Expand All @@ -76,3 +79,21 @@ build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/langchain_linkup"]

[tool.semantic_release]
allow_zero_version = true
build_command = """
python -m pip install -e '.[build]'
uv lock --upgrade-package "$PACKAGE_NAME"
git add uv.lock
uv build
"""
commit_message = "chore: release v{version}\n\nAutomatically generated by python-semantic-release\n\n[skip ci]" # [skip ci] is needed to avoid recursively calling the release CI
major_on_zero = false
version_toml = ["pyproject.toml:project.version"]

[tool.semantic_release.commit_parser_options]
parse_squash_commits = false

[tool.uv]
required-version = ">=0.10.0,<0.11.0"
Loading