-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (50 loc) · 1.61 KB
/
test-build-publish.yml
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
name: Test, Build, Release, Publish (Pypi)
on:
push:
tags:
- "v*" # When a tag like vx.x.x is pushed
jobs:
build:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: |
3.9
3.10
3.11
- name: Set up pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ runner.os }}-pip-
- name: Set up hatch cache
uses: actions/cache@v3
with:
path: ~/.hatchcache
key: ${{ runner.os }}-hatchcache-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ runner.os }}-hatchcache-
- name: Set up hatch cache (data)
uses: actions/cache@v3
with:
path: ~/.hatchdata
key: ${{ runner.os }}-hatchdata-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ runner.os }}-hatchdata-
- name: Install Hatch
run: pipx install hatch
- name: Run tests
run: hatch --cache-dir ~/.hatchcache --data-dir ~/.hatchdata run test
- name: Lint and Type check
run: hatch --cache-dir ~/.hatchcache --data-dir ~/.hatchdata -e lint run all
- name: Build dist
run: hatch --cache-dir ~/.hatchcache --data-dir ~/.hatchdata build
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"