-
Notifications
You must be signed in to change notification settings - Fork 96
58 lines (56 loc) · 1.58 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Release
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-publish:
if: github.repository_owner == 'pypa'
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
cache-dependency-path: .github/workflows/release.yml
- name: Lint
run: make lint
- name: Test
run: make test
- name: Install build dependencies
run: pip install -U setuptools wheel build calver
- name: Build
run: python -m build .
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
release:
if: github.repository_owner == 'pypa'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
cache-dependency-path: .github/workflows/release.yml
- name: Install build dependencies
run: pip install -U setuptools wheel build calver
- name: Version
id: version
run: echo "version=$(python setup.py --version 2>/dev/null)" >> $GITHUB_OUTPUT
- name: Tag
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: ${{ steps.version.outputs.version }}
draft: false
prerelease: false