Skip to content

Commit a8b757a

Browse files
modify release
1 parent dffb9bd commit a8b757a

File tree

1 file changed

+59
-18
lines changed

1 file changed

+59
-18
lines changed

.github/workflows/_release.yml

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,72 @@
1-
name: Upload Python Package to PyPI when a Release is Created
1+
# This workflow will upload a Python Package to PyPI when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
210

311
# on:
412
# release:
5-
# types: [created]
13+
# types: [published]
14+
615
on: workflow_dispatch
716

17+
permissions:
18+
contents: read
19+
820
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+
943
pypi-publish:
10-
name: Publish release to PyPI
1144
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
1253
environment:
1354
name: pypi
55+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
1456
url: https://pypi.org/p/langchain-oci
15-
permissions:
16-
id-token: write
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+
1762
steps:
18-
- uses: actions/checkout@v4
19-
- name: Set up Python
20-
uses: actions/setup-python@v4
63+
- name: Retrieve release distributions
64+
uses: actions/download-artifact@v4
2165
with:
22-
python-version: "3.x"
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install setuptools wheel
27-
- name: Build package
28-
run: |
29-
python setup.py sdist bdist_wheel # Could also be python -m build
30-
- name: Publish package distributions to PyPI
31-
uses: pypa/gh-action-pypi-publish@release/v1
66+
name: release-dists
67+
path: dist/
68+
69+
- name: Publish release distributions to PyPI
70+
uses: pypa/gh-action-pypi-publish@release/v1
71+
with:
72+
packages-dir: dist/

0 commit comments

Comments
 (0)