Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAGO-79372: Add Publish workflow #3

Merged
merged 5 commits into from
Jul 8, 2024
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
74 changes: 74 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release
on:
workflow_dispatch:
inputs:
version:
type: choice
required: true
description: "Version bump type"
options:
- patch
- minor
- major

jobs:
release:
name: Release
timeout-minutes: 20
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/solace_ai_connector
permissions:
id-token: write
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.COMMIT_KEY }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install hatch
run: |
pip install --upgrade pip
pip install hatch

- name: Bump Version
run: |
CURRENT_VERSION=$(hatch version)
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
hatch version "${{ github.event.inputs.version }}"
NEW_VERSION=$(hatch version)
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV

- name: Fail if the current version doesn't exist
if: env.CURRENT_VERSION == ''
run: exit 1

- name: Build project for distribution
run: hatch build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.whl"
makeLatest: true
generateReleaseNotes: true
tag: ${{ env.CURRENT_VERSION }}

- name: Commit new version
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -a -m "[ci skip] Bump version to $NEW_VERSION"
git push
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"

[project]
name = "solace_ai_connector"
version = "0.0.1"
dynamic = ["version"]
authors = [
{ name="Edward Funnekotter", email="[email protected]" },
]
Expand Down Expand Up @@ -39,3 +39,6 @@ solace-ai-connector-gen-docs = "solace_ai_connector.tools.gen_component_docs:mai

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

[tool.hatch.version]
path = "src/solace_ai_connector/__init__.py"