-
Notifications
You must be signed in to change notification settings - Fork 6
91 lines (79 loc) · 2.68 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
88
89
90
91
name: PyPI Release
on:
workflow_dispatch:
inputs:
version:
description: Version
required: false
default: patch
type: choice
options:
- patch
- minor
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install poetry
shell: bash
run: pip install poetry=="1.4.2"
- name: Build isolate
run: |
VERSION_TYPE="${{ github.event.inputs.version }}"
poetry version $VERSION_TYPE
# version has format '0.4.1'
current_version=$(poetry version -s)
echo "current_version=$current_version" >> $GITHUB_ENV
# tag has format 'v0.4.0' (note the 'v')
prev_version_tag=$(git describe --tags --abbrev=0)
echo "prev_version_tag=$prev_version_tag" >> $GITHUB_ENV
poetry build
- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: cliff.toml
args: ${{ env.prev_version_tag }}..HEAD
env:
OUTPUT: CHANGES.md
- name: Set the release body
id: release
shell: bash
run: |
[[ -f ${{ steps.git-cliff.outputs.changelog }} ]] && r=$(< ${{ steps.git-cliff.outputs.changelog }}) || r=''
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "::set-output name=RELEASE_BODY::$r"
- name: Publish GitHub
uses: softprops/action-gh-release@v1
with:
name: isolate ${{ env.current_version }}
body: ${{ steps.release.outputs.RELEASE_BODY }}
tag_name: v${{ env.current_version }}
files: |
dist/isolate-${{env.current_version}}-py3-none-any.whl
dist/isolate-${{env.current_version}}.tar.gz
- name: Publish PyPI
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD -v -n
- name: Bump repo version
run: |
git clean -fxd # Clear all the changes
poetry version ${{env.current_version}}
poetry version prepatch
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
delete-branch: true
title: Bump the pyproject.toml version
base: main
token: ${{ secrets.RELEASER_GITHUB_PAT }}