-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (41 loc) · 1.13 KB
/
release.yml
File metadata and controls
49 lines (41 loc) · 1.13 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
name: release
on:
workflow_dispatch:
inputs:
tag:
description: "Git tag to publish (e.g. v1.1.0). Leave blank to use latest tag."
required: false
permissions:
contents: read
id-token: write # needed for PyPI Trusted Publishing
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: determine tag
id: tag
run: |
git fetch --tags
if [ -z "${{ inputs.tag }}" ]; then
TAG=$(git describe --tags "$(git rev-list --tags --max-count=1)")
else
TAG=${{ inputs.tag }}
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Publishing tag: $TAG"
- name: checkout tag
run: |
git checkout ${{ steps.tag.outputs.tag }}
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: |
python -m pip install --upgrade pip build
python -m build
- name: publish to PyPI (trusted)
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist