-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.92 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Set up Poetry
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
with:
path: .venv
key: ${{ runner.os }}-venv-py3.9-${{ hashFiles('**/poetry.lock') }}
- name: Install package
run: poetry install
- name: Run linters
run: poetry run task lint
- name: Run tests
run: poetry run task test
release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'cd skip')
steps:
- uses: actions/checkout@v2
- name: Bump version
uses: TriPSs/conventional-changelog-action@v3
id: version
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-user-name: "GitHub Actions"
git-user-email: "[email protected]"
version-file: pyproject.toml
version-path: tool.poetry.version
preset: conventionalcommits
output-file: false
- name: Publish to GitHub
if: steps.version.outputs.skipped == 'false'
run: gh release create "$TAG" --notes "$BODY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.version.outputs.tag }}
BODY: ${{ steps.version.outputs.clean_changelog }}
- name: Publish to PyPI
if: steps.version.outputs.skipped == 'false'
run: pip install poetry && poetry publish --build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}