Skip to content

Commit 1c8f148

Browse files
use twine to publish
1 parent a8b757a commit 1c8f148

File tree

1 file changed

+36
-51
lines changed

1 file changed

+36
-51
lines changed

.github/workflows/_release.yml

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,50 @@
88

99
name: Upload Python Package
1010

11-
# on:
12-
# release:
13-
# types: [published]
14-
15-
on: workflow_dispatch
11+
on:
12+
release:
13+
types: [published]
14+
workflow_dispatch:
1615

1716
permissions:
1817
contents: read
1918

2019
jobs:
21-
release-build:
22-
runs-on: ubuntu-latest
23-
24-
steps:
25-
- uses: actions/checkout@v4
26-
27-
- uses: actions/setup-python@v5
28-
with:
29-
python-version: "3.x"
30-
31-
- name: Build release distributions
32-
run: |
33-
# NOTE: put your own distribution build steps here.
34-
python -m pip install build
35-
python -m build
36-
37-
- name: Upload distributions
38-
uses: actions/upload-artifact@v4
39-
with:
40-
name: release-dists
41-
path: dist/
42-
43-
pypi-publish:
20+
build-n-publish:
21+
name: Build and publish Python 🐍 distribution 📦 to PyPI
4422
runs-on: ubuntu-latest
45-
needs:
46-
- release-build
47-
permissions:
48-
# IMPORTANT: this permission is mandatory for trusted publishing
49-
id-token: write
50-
51-
# Dedicated environments with protections for publishing are strongly recommended.
52-
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
5323
environment:
5424
name: pypi
55-
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
5625
url: https://pypi.org/p/langchain-oci
57-
#
58-
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
59-
# ALTERNATIVE: exactly, uncomment the following line instead:
60-
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
61-
6226
steps:
63-
- name: Retrieve release distributions
64-
uses: actions/download-artifact@v4
65-
with:
66-
name: release-dists
67-
path: dist/
68-
69-
- name: Publish release distributions to PyPI
70-
uses: pypa/gh-action-pypi-publish@release/v1
27+
- uses: actions/checkout@v4
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
7130
with:
72-
packages-dir: dist/
31+
python-version: "3.x"
32+
- name: Build distribution 📦
33+
run: |
34+
pip install build
35+
make dist
36+
- name: Validate
37+
run: |
38+
pip install dist/*.whl
39+
python -c "import langchain-oci;"
40+
## To run publish to test PyPI a secret with token needs to be added,
41+
## this one GH_ADS_TESTPYPI_TOKEN - removed after initial test.
42+
## Project name also needed to be updated in pyproject.toml - name = "test_oracle_ads" in [project] section
43+
## regular name is occupied by former developer and can't be used for testing
44+
# - name: Publish distribution 📦 to Test PyPI
45+
# env:
46+
# TWINE_USERNAME: __token__
47+
# TWINE_PASSWORD: ${{ secrets.GH_ADS_TESTPYPI_TOKEN }}
48+
# run: |
49+
# pip install twine
50+
# twine upload -r testpypi dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
51+
- name: Publish distribution 📦 to PyPI
52+
env:
53+
TWINE_USERNAME: __token__
54+
TWINE_PASSWORD: ${{ secrets.GH_LC_OCI_PYPI_TOKEN }}
55+
run: |
56+
pip install twine
57+
twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD

0 commit comments

Comments
 (0)