Skip to content

Commit

Permalink
ENH: Workflow to publish to PyPI on GitHub release.
Browse files Browse the repository at this point in the history
Allow [ci skip]
  • Loading branch information
pllim committed Feb 5, 2021
1 parent 4b2e219 commit e64370b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,25 @@ on:
- master

jobs:
cancel_ci:
name: Mandatory checks before CI
runs-on: ubuntu-latest
outputs:
run_next: ${{ steps.skip_ci_step.outputs.run_next }}
steps:
- name: Check skip CI
uses: OpenAstronomy/action-skip-ci@main
id: skip_ci_step
with:
NO_FAIL: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# The rest only run if above are done

pep_and_audit:
runs-on: ubuntu-16.04
needs: cancel_ci
if: needs.cancel_ci.outputs.run_next == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -38,6 +55,8 @@ jobs:
# Python 3.7 + Numpy 1.19 resulted in NaN results, so we downgrade Numpy.
initial_tests:
runs-on: ubuntu-16.04
needs: cancel_ci
if: needs.cancel_ci.outputs.run_next == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -60,6 +79,8 @@ jobs:

dev_deps_tests:
runs-on: ubuntu-latest
needs: cancel_ci
if: needs.cancel_ci.outputs.run_next == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
release:
types: [released]

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
if: github.repository == 'spacetelescope/exovetter'

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python-build and twine
run: python -m pip install build "twine>=3.3"

- name: Build package
run: python -m build --sdist --wheel .

- name: List result
run: ls -l dist

- name: Check dist
run: python -m twine check --strict dist/*

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

0 comments on commit e64370b

Please sign in to comment.