-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 2.66 KB
/
pre-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
name: Prerelease
on:
push:
branches: [alpha, beta, next]
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
fromTag: ${{ steps.fromTag.outputs.tag }}
toTag: ${{ steps.toTag.outputs.tag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: 'Get Previous tag'
id: fromTag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Installing python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Installing poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.6.1'
- name: Install deps
run: poetry install
- name: Run matic-release
run: poetry run python scripts/release.py --ci
- name: Build a binary wheel and a source tarball
run: poetry run python setup.py sdist
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish tag
run: git push --tags
- name: 'Get lastest tag'
id: toTag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
pypi-publish:
if: ${{ needs.build.outputs.fromTag != needs.build.outputs.toTag }}
name: Upload release to PyPI
runs-on: ubuntu-latest
needs:
- build
environment:
name: pypi
url: https://pypi.org/p/turbobus
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
generate-release:
if: ${{ needs.build.outputs.fromTag != needs.build.outputs.toTag }}
runs-on: ubuntu-latest
needs:
- build
- pypi-publish
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up git-cliff
uses: kenji-miyake/setup-git-cliff@v1
- name: Run git-cliff
run: |
{
echo 'CHANGELOG<<EOF'
git cliff --latest
echo EOF
} >> "$GITHUB_ENV"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{ env.CHANGELOG }}
prerelease: true
tag_name: ${{ needs.build.outputs.toTag }}