-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (37 loc) · 1.08 KB
/
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
# Copyright DB Netz AG and contributors
# SPDX-License-Identifier: CC0-1.0
name: Publish package
on:
workflow_dispatch:
push:
branches: [master]
tags: ["v*"]
pull_request:
jobs:
publish:
name: Publish artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: pyproject.toml
python-version: "3.11"
- name: Install dependencies
run: python -m pip install -U pip build twine
- name: Build packages
run: python -m build
- name: Verify packages
run: python -m twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: 'dist/*'
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/*