This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
126 lines (105 loc) · 3.18 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: 'Release'
on:
workflow_dispatch:
inputs:
releaseLevel:
description: 'Release level'
required: true
type: choice
default: 'patch'
options:
- 'patch' # bug fixes
- 'minor' # new features, backwards compatible
- 'major' # breaking changes
generateBranch:
description: 'Whether to generate a release branch'
required: true
type: boolean
default: false
generateTag:
description: 'Whether to generate a release tag'
required: true
type: boolean
default: true
push:
env:
PYPI_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9 # The lowest we support
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
- name: Bump version
run: |
poetry version ${{ inputs.releaseLevel || 'patch' }}
- name: Store new version
id: get_version
run: |
echo ::set-output name=version::$(poetry version -s)
- name: Build wheel
run: |
poetry build
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/
test-all-OSes:
if: never()
needs: build
uses: ./.github/workflows/pre-release-CI.yml
publish:
needs: test-all-OSes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
- name: download wheels
uses: actions/download-artifact@v2
with:
path: ./dist/
- name: Set version
run: |
echo ${{ jobs.build.outputs.get_version }}
poetry version ${{ jobs.build.outputs.get_version }}
- name: Commit version update
run: |
git config --global user.name "GitHub Action"
git config --global user.email "[email protected]"
git add pyproject.toml
git commit -m "Bump version to $(poetry version -s)"
git push
# - name: Create tag
# if: ${{ github.event_name == 'workflow_dispatch' && inputs.generateTag == 'true' }}
# run: |
# git tag -a $(poetry version -s) -m "V$(poetry version -s)"
# git push origin "V$(poetry version -s)"
- name: Create release branch
if: ${{ github.event_name == 'workflow_dispatch' && inputs.generateBranch == 'true' }}
run: |
git checkout -b release/$(poetry version -s)
git push origin release/$(poetry version -s)
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "V$(poetry version -s)"
release_name: $(poetry version -s)