-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (95 loc) · 2.93 KB
/
publish.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
name: publish
on:
pull_request:
branches:
- main
types:
- closed
jobs:
publish:
if: ${{ (startsWith(github.event.pull_request.head.ref, 'release/')) && (github.event.pull_request.merged == true) }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: read
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Extract version from branch name
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Build changelog
id: build_changelog
uses: mikepenz/[email protected]
with:
configurationJson: |
{
"categories": [
{
"title": "## 🚀 Features",
"labels": ["type: feature"]
},
{
"title": "## 🐛 Bug fixes",
"labels": ["type: bug"]
},
{
"title": "## 🧪 Tests",
"labels": ["type: test"]
},
{
"title": "## 📓 Documentation",
"labels": ["type: docs"]
},
{
"title": "## 📁 Admin",
"labels": ["type: admin"]
}
],
"template": "#{{CHANGELOG}}---\n\n**Full Changelog**: https://github.com/${{ github.repository }}/compare/#{{FROM_TAG}}...${{ env.RELEASE_VERSION }}\n",
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in #{{URL}}"
}
toTag: ${{ github.event.pull_request.merge_commit_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ncipollo/release-action@v1
with:
commit: ${{ github.event.pull_request.merge_commit_sha }}
tag: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
body: ${{ steps.build_changelog.outputs.changelog }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Build project
run: |
poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- name: Generate version badge
if: success()
uses: knightdave/[email protected]
with:
file: docs/_badges/version.svg
label: version
value: ${{ env.RELEASE_VERSION }}
color: teal
template: docs/_badges/template.svg
overwrite: true
- name: Publish badge
if: success()
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_badges
target-folder: _badges
clean: false