-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (56 loc) · 1.59 KB
/
ci.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
52
53
54
55
56
57
58
59
60
61
62
name: GitHub CI
# run only on main branch. This avoids duplicated actions on PRs
on:
pull_request:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.10'
PACKAGE_NAME: 'ansys-api-acp'
jobs:
build-library:
name: "Build package"
runs-on: ubuntu-latest
steps:
- name: "Build library source and wheel artifacts"
uses: ansys/actions/build-library@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
pre-commit:
name: "Pre-commit checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: "Install pre-commit"
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: "Run pre-commit"
run: |
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
release:
name: "Release package"
runs-on: ubuntu-latest
needs: [build-library]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to the public PyPI repository"
uses: ansys/actions/release-pypi-public@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
twine-username: "__token__"
twine-token: ${{ secrets.PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
./**/*.whl
./**/*.tar.gz