Skip to content

Build and Upload Release #8

Build and Upload Release

Build and Upload Release #8

Workflow file for this run

name: Build and Upload Release
on:
release:
types:
- created
jobs:
build:
name: Build and Upload
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -r requirements.txt
- name: Build Package
run: |
python setup.py sdist bdist_wheel
- name: Upload to Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload dist for Next Jobs
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
test-pypi:
name: Upload to test.pypi.org & test installation
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install twine
pip install -r requirements.txt
- name: Download dist from Previous Job
uses: actions/download-artifact@v2
with:
name: dist
- name: Extract package version
run: |
VERSION=$(python3 -c "import pyclasher; print(pyclasher.__version__)")
echo "Package version: $VERSION"
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload
run: python3 -m twine upload -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} --repository testpypi dist/*
- name: Test
run: pip install -i -i https://test.pypi.org/simple/ pyclasher==$PACKAGE_VERSION
pypi:
name: Upload to pypi.org
runs-on: ubuntu-latest
needs:
- build
- test-pypi
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install twine
run: |
python -m pip install --upgrade pip
pip install twine
- name: Download dist from Previous Job
uses: actions/download-artifact@v2
with:
name: dist
- name: Upload
run: python3 -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --repository pypi dist/*