Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 twine | |
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} *.whl |