117 lines
3.7 KiB
YAML
117 lines
3.7 KiB
YAML
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_notes:
|
|
description: Release notes (use \n for newlines)
|
|
type: string
|
|
required: false
|
|
github_release:
|
|
description: 'Create Gitea Release'
|
|
default: true
|
|
type: boolean
|
|
bump:
|
|
description: 'Bump type'
|
|
required: true
|
|
default: 'patch'
|
|
type: choice
|
|
options:
|
|
- 'major'
|
|
- 'minor'
|
|
- 'patch'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
- name: Set up Python
|
|
run: uv python install
|
|
with:
|
|
python-version-file: "pyproject.toml"
|
|
|
|
- name: Install the project
|
|
run: uv sync --locked --all-extras --dev
|
|
- name: Set Git identity
|
|
run: |
|
|
git config user.name "Gitea CI"
|
|
git config user.email "ci@git.theprivateserver.de"
|
|
- name: Bump version
|
|
id: bump
|
|
run: |
|
|
uv tool install bump-my-version
|
|
uv tool run bump-my-version bump ${{ github.event.inputs.bump }}
|
|
# echo the version to github env, the version is shown by using uv tool run bump-my-version show current_version
|
|
echo "VERSION<<EOF" >> $GITHUB_ENV
|
|
echo "$(uv tool run bump-my-version show current_version)" >> $GITHUB_ENV
|
|
echo "EOF" >> $GITHUB_ENV
|
|
- name: Check version
|
|
run: echo ${{ env.VERSION }}
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: ${{ github.ref }}
|
|
- name: Build Changelog
|
|
uses: https://github.com/mikepenz/release-changelog-builder-action@v5
|
|
with:
|
|
platform: "gitea" # gitea or GitHub, default is GitHub
|
|
mode: "COMMIT"
|
|
configurationJson: |
|
|
{
|
|
"template": "#{{CHANGELOG}}",
|
|
"categories": [
|
|
{
|
|
"title": "## Feature",
|
|
"labels": ["feat", "feature"]
|
|
},
|
|
{
|
|
"title": "## Fix",
|
|
"labels": ["fix", "bug"]
|
|
},
|
|
{
|
|
"title": "## Other",
|
|
"labels": []
|
|
}
|
|
],
|
|
"label_extractor": [
|
|
{
|
|
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
|
|
"on_property": "title",
|
|
"target": "$1"
|
|
}
|
|
]
|
|
}
|
|
token: ${{ secrets.TOKEN }}
|
|
owner: WorldTeacher
|
|
- name: create Release
|
|
if: ${{ github.event.inputs.github_release == 'true' }}
|
|
uses: softprops/action-gh-release@master
|
|
with:
|
|
tag_name: ${{ env.VERSION }}
|
|
release_name: Release ${{ env.VERSION }}
|
|
body: ${{ steps.changelog.outputs.changelog }}
|
|
|
|
# - name: Add release notes to environment
|
|
# id: add_release_notes
|
|
# run: |
|
|
# echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
|
|
# echo "${{ github.event.inputs.release_notes }}" >> $GITHUB_ENV
|
|
# echo "EOF" >> $GITHUB_ENV
|
|
# - name: Create release
|
|
# id: create_release
|
|
# if: ${{ github.event.inputs.github_release == 'true' }}
|
|
# uses: softprops/action-gh-release@master
|
|
# with:
|
|
# tag_name: ${{ env.VERSION }}
|
|
# release_name: Release ${{ env.VERSION }}
|
|
# body: ${{ env.RELEASE_NOTES }}
|
|
# draft: false
|
|
# prerelease: false
|
|
# make_latest: true
|
|
# env:
|
|
# GITHUB_TOKEN: ${{ secrets.TOKEN }}
|