-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.62 KB
/
publish.yml
File metadata and controls
60 lines (51 loc) · 1.62 KB
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
name: Publish to PyPI
on:
workflow_dispatch:
inputs:
repository:
description: "Target repository"
type: choice
options:
- testpypi
- pypi
default: testpypi
run_tests:
description: "Run test suite before publish"
type: boolean
default: true
permissions:
contents: read
id-token: write
jobs:
build-and-publish:
if: github.event_name == 'workflow_dispatch' && github.repository == 'NetSPI/oci-lexer-parser' && github.actor == 'WebbinRoot'
runs-on: ubuntu-latest
environment: ${{ inputs.repository }}
steps:
- name: Checkout
# v6.0.2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Python
# v6.2.0
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: "3.12"
- name: Install build tools
run: python -m pip install --upgrade pip build
- name: Run tests
if: ${{ inputs.run_tests }}
run: |
python -m pip install .[dev]
python -m pytest -q -m "not generate_json"
- name: Build dist
run: python -m build
- name: Publish to PyPI
if: ${{ inputs.repository == 'pypi' }}
# v 1.14.0
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
- name: Publish to TestPyPI
if: ${{ inputs.repository == 'testpypi' }}
# v1.14.0
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
with:
repository-url: https://test.pypi.org/legacy/