-
Notifications
You must be signed in to change notification settings - Fork 3
42 lines (41 loc) · 1.43 KB
/
release.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
41
42
name: Release
on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-rc.*'
jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
# Checkout the tag that triggered the workflow
with:
ref: ${{ github.ref }}
- uses: actions/setup-python@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Build package
run: |
python -m build
- name: Publish package distributions to PyPI
# Only run if the tag is a release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'rc')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish package to Test PyPI
# Only run if the tag is a release candidate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'rc')
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Create release
run : |
semantic-release publish --tag ${{ github.ref }}