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
57 changes: 33 additions & 24 deletions .github/workflows/ibm_db_sa_publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Build and upload to PyPI
name: Publish IBM_DB_SA Package

# Build on every workflow_dispatch, branch push, tag push, and pull request change
on:
workflow_dispatch:
pull_request:
Expand All @@ -11,29 +10,39 @@ on:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
deploy:
permissions:
contents: read
id-token: write # Required for trusted publishing to PyPI via OIDC

jobs:
publish-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: pypi # Environment where PYPI_API_TOKEN secret is stored

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build
- name: Publish distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write # Added permission for GitHub Actions to push tags
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build

- name: Build package
run: python -m build

- name: Publish to PyPI with trusted publishing (OIDC)
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
# Use GitHub OIDC token to authenticate instead of password
# The action supports OIDC automatically when password is empty
# so leave password empty and it will use OIDC.
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
setup(
name='ibm_db_sa',
version=VERSION,
license='Apache License 2.0',
license = "Apache-2.0",
license_files = ("LICENSE",),
description='SQLAlchemy support for IBM Data Servers',
author='IBM Application Development Team',
author_email='balram.choudhary@ibm.com',
Expand All @@ -30,7 +31,6 @@
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Topic :: Database :: Front-Ends'
],
Expand Down