From fd2356b265a37c859c756a0cc9bcbe8b9f22761f Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 20 May 2021 09:19:33 -0400 Subject: [PATCH] ci: follow guidelines for deploy (#36) * ci: follow guidelines for deploy * ci: add standard deploy --- .github/workflows/cd.yml | 43 ++++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 40 +++-------------------------------- 2 files changed, 46 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..b510586 --- /dev/null +++ b/.github/workflows/cd.yml @@ -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/gh-action-pypi-publish@v1.4.2 + with: + password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb7c1b1..b471075 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,9 +3,7 @@ name: CI on: pull_request: push: - branches: master - tags: - - 'v*' + branches: [master] jobs: @@ -15,9 +13,9 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 + - uses: pre-commit/action@v2.0.2 - name: Check manifest - uses: pre-commit/action@v2.0.0 + uses: pre-commit/action@v2.0.2 with: extra_args: --hook-stage manual check-manifest @@ -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')