-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.88 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
name: "Release"
on:
release:
types: [ created ]
branches:
- main
jobs:
release:
name: "Generate release and publish to PyPI"
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tunsberg
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.KILOBYTE_BOT_PAT }}
fetch-tags: true
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Git Config
run: |
git config --global user.email "[email protected]"
git config --global user.name "kilobyte-bot"
- name: Update __version__ in __init__.py
run: |
git pull origin HEAD:main
echo "Version: ${{ github.ref_name }}"
sed -i "s/__version__ = .*/__version__ = '${{ github.ref_name }}'/" ./tunsberg/__init__.py
cat ./tunsberg/__init__.py
git commit -am "Bump version to ${{ github.ref_name }}"
git push origin HEAD:main
- name: Build package
run: python setup.py bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Post release to Discord
uses: SethCohen/[email protected]
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
color: "16753920"
username: "kilobyte-bot"
avatar_url: "https://avatars.githubusercontent.com/u/98578253?s=200&v=4"
content: "@here A new release has been published! :rocket:"
footer_title: ${{ github.event.release.name }}
footer_timestamp: true