forked from btschwertfeger/python-cmethods
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.37 KB
/
_pypi_publish.yml
File metadata and controls
51 lines (43 loc) · 1.37 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
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# GitHub: https://github.com/btschwertfeger
#
# Template workflow to build the project and publish
# the package to PyPI. It can be used to publish on the
# test index and the "live" PyPI index.
#
name: PyPI Publish
on:
workflow_call:
inputs:
REPOSITORY_URL:
type: string
required: true
secrets:
API_TOKEN:
required: true
jobs:
PyPI-Publish:
name: Upload to ${{ inputs.REPOSITORY_URL }}
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for OIDC publishing
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # IMPORTANT: otherwise the current tag does not get fetched and the build version gets worse
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Build the package
run: python -m pip wheel -w dist --no-deps .
- name: Publish package distributions to PyPI (optional - testpypi)
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.API_TOKEN }}
repository-url: ${{ inputs.REPOSITORY_URL }}