-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create build_python_package.yml (#20)
- Loading branch information
1 parent
32f50ac
commit d1b7a57
Showing
1 changed file
with
104 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Publish Python 🐍 distribution 📦 to PyPI and run tests | ||
|
||
|
||
on: | ||
workflow_dispatch: | ||
|
||
release: | ||
types: [created] | ||
|
||
|
||
jobs: | ||
build: | ||
if: github.repository == 'CaffeineCrew/Techdocs' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install package-dependencies | ||
- run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel | ||
- name: build package | ||
- run: | | ||
python python setup.py sdist bdist_wheel | ||
- name: Store dist as an artifact | ||
- uses: actions/upload-artifact@v3 | ||
- with: | ||
name: python-package | ||
path: dist/ | ||
|
||
|
||
publish_package_to_testpypi: | ||
if: github.repository == 'CaffeineCrew/Techdocs' | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install twine | ||
- name: Publish 📦 to testpypi | ||
env: | ||
TESETPYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TESTPYPI_CLI: ${{ secrets.PYPI_PASSWORD }} | ||
- uses: actions/download-artifact@v3 | ||
- with: | ||
name: python-package | ||
- run: | | ||
twine upload -r testpypi dist/* | ||
run_tests: | ||
needs: [build, publish_package_to_testpypi] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- working-directory: /techdocs | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --no-cache-dir --index-url https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple/ techdocs | ||
- name: Test testpypi package | ||
run: | | ||
techdocs run tests | ||
publish_package_to_pypi: | ||
needs: [build, publish_package_to_testpypi, run_tests] | ||
if: github.repository == 'CaffeineCrew/Techdocs' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Publish 📦 to pypi | ||
env: | ||
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
PYPI_CLI: ${{ secrets.PYPI_PASSWORD }} | ||
- uses: actions/download-artifact@v3 | ||
- with: | ||
name: python-package | ||
- run: | | ||
twine upload dist/* | ||
pip install techdocs --upgrade | ||