-
Notifications
You must be signed in to change notification settings - Fork 1.5k
87 lines (83 loc) · 3.43 KB
/
build_and_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
- name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- "*"
jobs:
build-and-publish-test-pypi:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.tag.outputs.TAG_NAME }} # Assuming you have a step with id 'tag' that outputs the tag name
environment:
name: pypi
url: https://test.pypi.org/p/dspy-ai-test
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: python3 -m pip install setuptools wheel twine
- name: Extract tag name
id: tag
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Update version in setup.py
run: sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g"
setup.py
- name: Update version in pyproject.toml
run: sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g"
pyproject.toml
- name: Build a binary wheel
run: python3 setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi/testpypi
with:
repository-url: https://test.pypi.org/legacy/
test-intro-script:
needs: build-and-publish-test-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install package from TestPyPI
run: |
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple your-package-name==${{ needs.build-and-publish-test-pypi.outputs.version }}
- name: Run Python script
run: |
python3 tests/build/intro.py
# build-and-publish-pypi:
# needs: [build-and-publish-test-pypi, test-intro-notebook]
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/p/dspy-ai
# permissions:
# id-token: write # IMPORTANT: mandatory for trusted publishing
# steps:
# - uses: actions/checkout@master
# - name: Set up Python 3.9
# uses: actions/setup-python@v3
# with:
# python-version: "3.9"
# - name: Install dependencies
# run: python3 -m pip install setuptools wheel twine
# - name: Extract tag name
# id: tag
# run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
# - name: Update version in setup.py
# run: sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g"
# setup.py
# - name: Build a binary wheel
# run: python3 setup.py sdist bdist_wheel
# - name: Publish distribution 📦 to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi/testpypi
# create-release-github: # TODO
# needs: needs: [build-and-publish-test-pypi, test-intro-notebook, build-and-publish-pypi]
# Make sure to include release notes