Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Enable auto PyPI release and allow skipping CI #47

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}