-
Notifications
You must be signed in to change notification settings - Fork 211
36 lines (29 loc) · 1.06 KB
/
pypi.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
name: "Build and Publish PyPi package"
on:
release:
types: [published]
permissions: read-all
jobs:
build_and_publish:
name: "Publish ccf package to PyPi"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get release number from git tag (release) or latest (branch)
run: |
echo "version=${GITHUB_REF#refs/tags/ccf-}" >> $GITHUB_OUTPUT
id: tref
- name: Fetch PyPi Package from release
run: |
cd python
RELEASE_WHEEL_URL=$(curl -s https://api.github.com/repos/microsoft/ccf/releases/tags/ccf-${{steps.tref.outputs.version}} | jq -r '.assets[] | select(.name|test("ccf-.*.whl")) | .browser_download_url')
wget ${RELEASE_WHEEL_URL}
- name: Publish PyPi Package to https://pypi.org/project/ccf/
run: |
set -ex
cd python
python3 -m venv env
source ./env/bin/activate
pip install -r requirements.txt
pip install twine
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} *.whl