Skip to content

Commit

Permalink
Merge pull request redpwn#167 from redpwn/ci/automated-release
Browse files Browse the repository at this point in the history
ci: automated publish to PyPI
  • Loading branch information
ethanwu10 authored Sep 20, 2021
2 parents 761d51f + 3842377 commit 0495ff2
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ name: CI
on:
push:
branches: [master]
tags:
- v*
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
python-version: 3.9

- name: Install dependencies
run: |
Expand All @@ -29,7 +28,7 @@ jobs:
run: poetry run pre-commit run --all-files

test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
Expand Down Expand Up @@ -58,3 +57,35 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
codecov --token="$CODECOV_TOKEN"
publish:
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/v')
needs:
- lint
- test
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade poetry
poetry --version
- name: Check tag is correct
run: |
[ $(poetry version -s) = ${GITHUB_REF##refs/tags/v} ]
- name: Build artifacts
run: poetry build

- name: Publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish

0 comments on commit 0495ff2

Please sign in to comment.