Skip to content

Commit

Permalink
Refactor ci/cd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Mar 26, 2020
1 parent 98b6642 commit bc6d050
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions .github/workflows/ci-cd-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: CI/CD pipeline
on: push
on:
push:
branches:
- master
release:
types: [published, prereleased]

jobs:
build-n-publish:
name: πŸ”¨ Build and πŸ“¦ publish distribution to TestPyPI & PyPI
runs-on: ubuntu-18.04
build:
name: πŸ”¨ Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: πŸ— Set up Python 3.7
uses: actions/setup-python@v1
with:
Expand All @@ -17,13 +22,40 @@ jobs:
- name: πŸ”¨ Build a binary wheel and a source tarball
run: >-
python setup.py sdist bdist_wheel
- name: πŸ“¦ Publish to TestPyPI
- name: ⬆ Upload build result
uses: actions/upload-artifact@v1
with:
name: dist
path: dist

publish-on-testpypi:
name: πŸ“¦ Publish on TestPyPI
needs: build
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: πŸ“¦ Publish to index
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: πŸ“¦ Publish tagged releases to PyPI
if: startsWith(github.event.ref, 'refs/tags')

publish-on-pypi:
name: πŸ“¦ Publish tagged releases to PyPI
if: startsWith(github.event.ref, 'refs/tags')
needs: build
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: πŸ“¦ Publish to index
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}

0 comments on commit bc6d050

Please sign in to comment.