Skip to content

Commit

Permalink
GitHub action improvements (#79)
Browse files Browse the repository at this point in the history
* Improvements to deploy.
  • Loading branch information
alexdlaird committed Feb 12, 2021
1 parent a86ac00 commit 72530f8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
@@ -1,4 +1,4 @@
name: build
name: "CI/CD"

on:
push:
Expand All @@ -8,6 +8,7 @@ on:

jobs:
build:
name: Build

strategy:
fail-fast: false
Expand Down Expand Up @@ -36,16 +37,13 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install virtualenv
python -m virtualenv venv
make install
- name: Run tests
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
nosetests --traverse-namespace
else
make test
make local
make test local
fi
shell: bash
- name: Upload coverage
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
analyse:
name: Analyse

runs-on: ubuntu-latest

steps:
Expand Down
48 changes: 30 additions & 18 deletions .github/workflows/deploy.yml
@@ -1,30 +1,42 @@
name: deploy
name: "CI/CD"

on:
workflow_run:
workflows: ["build"]
types:
- completed
release:
types: [created]

jobs:
deploy:
name: Publish Python package on release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Deploy

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Prepare dist
python-version: 3.x
- name: Install dependencies
run: |
make install
make local
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Validate version
run: |
make validate-release VERSION=${{ steps.get_version.outputs.VERSION }}
- name: Run tests
run: |
make test
- name: Build
run: |
make local docs
python setup.py sdist bdist_wheel
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
<p align="center"><img alt="pyngrok - a Python wrapper for ngrok" src="https://pyngrok.readthedocs.io/en/latest/_images/logo.png" /></p>

[![PyPI version](https://badge.fury.io/py/pyngrok.svg)](https://badge.fury.io/py/pyngrok)
[![build](https://github.com/alexdlaird/pyngrok/workflows/build/badge.svg)](https://github.com/alexdlaird/pyngrok/actions?query=workflow%3Abuild)
[![CI/CD](https://github.com/alexdlaird/pyngrok/workflows/CI/CD/badge.svg)](https://github.com/alexdlaird/pyngrok/actions?query=workflow%3ACI%2FCD)
[![codecov](https://codecov.io/gh/alexdlaird/pyngrok/branch/master/graph/badge.svg)](https://codecov.io/gh/alexdlaird/pyngrok)
[![Documentation Status](https://readthedocs.org/projects/pyngrok/badge/?version=latest)](https://pyngrok.readthedocs.io/en/latest/?badge=latest)
[![image](https://img.shields.io/pypi/pyversions/pyngrok.svg)](https://pypi.org/project/pyngrok/)
Expand Down

0 comments on commit 72530f8

Please sign in to comment.