-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (76 loc) · 2.28 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Release
on:
workflow_dispatch:
inputs:
rule:
description: "Rule to run"
required: false
default: patch
type: choice
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install poetry
- name: Get changelog
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GH_TOKEN }}
dry_run: true
- name: Update version
run: |
poetry version ${{ github.event.inputs.rule }}
version=$(poetry version -s)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Publish package
env:
PYPI_LOCAL_USERNAME: __token__
PYPI_LOCAL_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
poetry publish -u $PYPI_LOCAL_USERNAME -p $PYPI_LOCAL_PASSWORD
- name: Set up git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- uses: peter-evans/create-pull-request@v5
with:
commit-message: "[skip ci] Bump version to ${{ env.VERSION }}"
delete-branch: true
title: Bump version to ${{ env.VERSION }}
branch: release/${{ env.VERSION }}
body: |
Bump version to ${{ env.VERSION }}
${{ steps.tag_version.outputs.changelog }}
token: ${{ secrets.GH_TOKEN }}
- name: Create and push tag
run: |
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
draft: false
prerelease: false
body: ${{ steps.tag_version.outputs.changelog }}