mirror of
https://github.com/pufereq/python-template.git
synced 2025-12-15 15:49:32 +00:00
ci(release.yaml): migrate to PDM
This commit is contained in:
51
.github/workflows/release.yaml
vendored
51
.github/workflows/release.yaml
vendored
@@ -3,28 +3,19 @@ name: Bump version
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
description:
|
|
||||||
description: 'Release description'
|
|
||||||
required: true
|
|
||||||
bump_type:
|
bump_type:
|
||||||
type: choice
|
type: choice
|
||||||
description: 'Bump type'
|
description: 'Type of bump'
|
||||||
options:
|
|
||||||
- none (pre-release only)
|
|
||||||
- major
|
|
||||||
- minor
|
|
||||||
- patch
|
|
||||||
required: true
|
required: true
|
||||||
bump_type_pre_release:
|
|
||||||
type: choice
|
|
||||||
description: 'Pre-release type'
|
|
||||||
options:
|
options:
|
||||||
- release
|
- 'patch'
|
||||||
- alpha
|
- 'minor'
|
||||||
- beta
|
- 'major'
|
||||||
- rc
|
- 'pre_l'
|
||||||
- post
|
- 'pre_n'
|
||||||
- dev
|
short_description:
|
||||||
|
type: string
|
||||||
|
description: 'Short description of the release'
|
||||||
required: true
|
required: true
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
@@ -49,9 +40,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
cache: pip
|
cache: pip
|
||||||
- name: 📦 install required utilities
|
- name: 📦 setup pdm
|
||||||
run: |
|
uses: pdm-project/setup-pdm@v4
|
||||||
pip install git-cliff hatch --break-system-packages
|
with:
|
||||||
|
cache: true
|
||||||
|
- name: 📦 install dependencies
|
||||||
|
run: pdm install
|
||||||
- name: configure git
|
- name: configure git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
@@ -59,19 +53,16 @@ jobs:
|
|||||||
- name: 📦 bump version
|
- name: 📦 bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event.inputs.bump_type }}" == "none (pre-release only)" ]; then
|
bump-my-version ${{ github.event.inputs.bump_type }}
|
||||||
hatch version ${{ github.event.inputs.bump_type_pre_release }}
|
echo "BUMPED_VERSION=$(cat ${{ github.event.repository.name }}/__init__.py | grep __version__ | cut -d '"' -f 2)" >> $GITHUB_ENV
|
||||||
else
|
|
||||||
hatch version ${{ github.event.inputs.bump_type }},${{ github.event.inputs.bump_type_pre_release }}
|
|
||||||
fi
|
|
||||||
echo "BUMPED_VERSION=$(hatch version)" >> $GITHUB_OUTPUT
|
|
||||||
- name: 📝 create changelog
|
- name: 📝 create changelog
|
||||||
run: |
|
run: |
|
||||||
git-cliff -s header --unreleased -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > release_body.md
|
git-cliff -s header --unreleased -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > release_body.md
|
||||||
|
echo "Changes:" && cat release_body.md
|
||||||
git-cliff -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > CHANGELOG.md
|
git-cliff -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > CHANGELOG.md
|
||||||
- name: 📤 push changes
|
- name: 📤 push changes
|
||||||
run: |
|
run: |
|
||||||
git add CHANGELOG.md */__init__.py
|
git add CHANGELOG.md ${{ github.event.repository.name }}/__init__.py
|
||||||
git commit -m "chore(release): ${{ steps.bump_version.outputs.BUMPED_VERSION }}"
|
git commit -m "chore(release): ${{ steps.bump_version.outputs.BUMPED_VERSION }}"
|
||||||
git push origin main
|
git push origin main
|
||||||
- name: create release
|
- name: create release
|
||||||
@@ -79,10 +70,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
with:
|
with:
|
||||||
name: ${{ github.event.repository.name }} ${{ steps.bump_version.outputs.BUMPED_VERSION }}
|
name: ${{ github.event.repository.name }} ${{ steps.bump_version.outputs.BUMPED_VERSION }} - ${{ github.event.inputs.bump_type }}
|
||||||
tag_name: ${{ steps.bump_version.outputs.BUMPED_VERSION }}
|
tag_name: ${{ steps.bump_version.outputs.BUMPED_VERSION }}
|
||||||
body_path: release_body.md
|
body_path: release_body.md
|
||||||
prerelease: ${{ github.event.inputs.bump_type_pre_release != 'release' }}
|
prerelease: ${{ github.event.inputs.bump_type == 'pre_l' || github.event.inputs.bump_type == 'pre_n' }}
|
||||||
discussion_category_name: 'Announcements'
|
discussion_category_name: 'Announcements'
|
||||||
- name: 🧹 cleanup
|
- name: 🧹 cleanup
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user