Skip to content

PyPi Release workflow #3

PyPi Release workflow

PyPi Release workflow #3

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- v3-competition
pull_request:
branches:
- v3-competition
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
deploy-testpypi:
needs: build-and-test
if: github.event_name == 'pull_request' && github.ref == 'refs/heads/v3-competition'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish to Test PyPi with unique version
run: |
VERSION_SUFFIX=$(echo "${{ github.sha }}" | cut -c1-7)
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose --skip-existing
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
deploy:
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/v3-competition'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install twine
- name: Bump version
id: bump_version
run: |
bump2version patch --config-file .bumpversion.cfg
echo "::set-output name=new_version::$(cat .bumpversion.cfg | grep current_version | sed 's/^current_version = //')"
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
twine upload dist/* --skip-existing
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}