Skip to content

Commit

Permalink
ci: follow guidelines for deploy (#36)
Browse files Browse the repository at this point in the history
* ci: follow guidelines for deploy

* ci: add standard deploy
  • Loading branch information
henryiii authored May 20, 2021
1 parent f8ffc58 commit fd2356b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 37 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CD

on:
workflow_dispatch:
push:
branches:
- master
- main
release:
types:
- published

jobs:
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Build wheel and SDist
run: pipx run build

- uses: actions/upload-artifact@v2
with:
path: dist/*

- name: Check metadata
run: pipx run twine check dist/*


publish:
needs: [dist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
password: ${{ secrets.pypi_password }}
40 changes: 3 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: CI
on:
pull_request:
push:
branches: master
tags:
- 'v*'
branches: [master]


jobs:
Expand All @@ -15,9 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].2
- name: Check manifest
uses: pre-commit/[email protected].0
uses: pre-commit/[email protected].2
with:
extra_args: --hook-stage manual check-manifest

Expand Down Expand Up @@ -46,35 +44,3 @@ jobs:

- name: Test package
run: python -m pytest --cov hepunits

dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install wheel and sdist requirements
run: python -m pip install "setuptools>=42.0" "setuptools_scm[toml]>=3.4" "wheel"

- name: Build sdist
run: python setup.py sdist

- name: Build wheel
run: >
python -m pip wheel . -w wheels &&
ls -lh wheels &&
mkdir -p dist &&
cp wheels/hepunits*any.whl dist/
- uses: actions/upload-artifact@v1
with:
name: DistPackage
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')

0 comments on commit fd2356b

Please sign in to comment.