Release #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release" | |
on: | |
release: | |
types: [ created ] | |
branches: | |
- main | |
jobs: | |
update-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- 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 | |
pypi-publish: | |
name: Upload release 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: 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 all.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: | | |
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 |