-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (51 loc) · 1.61 KB
/
publish.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
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Publish to PyPI
on:
push:
tags:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags
- "v[12].[0-9]+.[0-9]+"
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
# Poetry must be installed before python setup for caching to work.
# https://github.com/actions/setup-python/issues/369
- name: Install Poetry
run: pipx install poetry
# https://github.com/actions/setup-python
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: poetry
# https://github.com/abatilo/actions-poetry/blob/master/action.yml
- name: Build package
run: poetry build
# https://github.com/actions/upload-artifact
- name: Store Package Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
name: publish
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dftxt
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# https://github.com/actions/download-artifact
- name: Get Package Artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
# https://github.com/marketplace/actions/pypi-publish
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1