Merge pull request #111 for release v1.2.0 #11
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
# 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@v2 | |
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@v2 | |
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@v2 | |
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 |