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 88 89 90 91 92 93 94 95 96 97
|
# This action releases orsopy on PyPI for every version tagged commit (e.g. v0.0.1)
name: PyPI/Github Release
on:
push:
tags:
- "v*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-ubuntu-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt update
sudo apt install python3 python3-setuptools python3-pip python3-yaml
pip3 install build
- name: Build PyPI package
run: |
python3 -m build
- name: Archive files
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist/orsopy*
check-version:
if: github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [build-ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Check version
run: |
PY_VERSION="$(python3 -c "import orsopy;print(orsopy.__version__)")"
GIT_VERSION="$(git describe --tags| cut -d 'v' -f 2)"
if [ $PY_VERSION == $GIT_VERSION ]; then
echo "$PY_VERSION OK"
else
echo "$PY_VERSION is not $GIT_VERSION"
exit 1
fi
release-github:
if: github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [check-version]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: dist
- uses: ncipollo/release-action@v1
with:
artifacts: "orsopy*.tar.gz,orsopy*.whl"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
release-pypi:
if: github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
needs: [check-version]
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: actions/download-artifact@v4
with:
name: dist
- name: Move assets
run: |
mkdir dist
mv orsopy*.tar.gz orsopy*.whl dist/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true
|