mirror of
https://github.com/pufereq/python-template.git
synced 2025-12-15 15:49:32 +00:00
ci(release.yml): migrate version bumping to hatchling
This commit is contained in:
78
.github/workflows/release.yml
vendored
78
.github/workflows/release.yml
vendored
@@ -3,20 +3,29 @@ name: Bump version
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
|
||||||
type: string
|
|
||||||
description: 'new tag number'
|
|
||||||
required: true
|
|
||||||
pre_release:
|
|
||||||
type: boolean
|
|
||||||
description: 'pre-release?'
|
|
||||||
required: true
|
|
||||||
description:
|
description:
|
||||||
type: string
|
description: 'Release description'
|
||||||
description: 'version description'
|
|
||||||
required: true
|
required: true
|
||||||
|
bump_type:
|
||||||
|
type: choice
|
||||||
|
description: 'Bump type'
|
||||||
|
options:
|
||||||
|
- none (pre-release only)
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
required: false
|
||||||
|
bump_type_pre_release:
|
||||||
|
type: choice
|
||||||
|
description: 'Pre-release type'
|
||||||
|
options:
|
||||||
|
- release
|
||||||
|
- alpha
|
||||||
|
- beta
|
||||||
|
- rc
|
||||||
|
- post
|
||||||
|
- dev
|
||||||
|
required: false
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
@@ -31,42 +40,49 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV
|
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV
|
||||||
- name: 🔀 checkout
|
- name: 🔀 checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: "${{ env.GH_TOKEN }}"
|
token: "${{ env.GH_TOKEN }}"
|
||||||
- name: 🐍 python
|
- name: 🐍 python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.11
|
python-version: '3.x'
|
||||||
cache: pip
|
cache: pip
|
||||||
- name: node
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: npm
|
|
||||||
- name: 📦 install required utilities
|
- name: 📦 install required utilities
|
||||||
run: |
|
run: |
|
||||||
pip install git-cliff --break-system-packages
|
pip install git-cliff hatch --break-system-packages
|
||||||
npm install -g release-it
|
|
||||||
- name: configure git
|
- name: configure git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
- name: 📝 bump version
|
- name: 📦 bump version
|
||||||
|
id: bump_version
|
||||||
run: |
|
run: |
|
||||||
git-cliff -s header -t ${{ github.event.inputs.version }} -u -o body.md
|
if [ "${{ github.event.inputs.bump_type }}" == "none (pre-release only)" ]; then
|
||||||
release-it ${{ github.event.inputs.version }}
|
hatch version bump ${{ github.event.inputs.bump_type_pre_release }}
|
||||||
|
else
|
||||||
|
hatch version bump ${{ github.event.inputs.bump_type }},${{ github.event.inputs.bump_type_pre_release }}
|
||||||
|
fi
|
||||||
|
echo "BUMPED_VERSION=$(hatch version)" >> $GITHUB_OUTPUT
|
||||||
|
- name: 📝 create changelog
|
||||||
|
run: |
|
||||||
|
git-cliff -s header --current -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > release_body.md
|
||||||
|
git-cliff > CHANGELOG.md
|
||||||
|
- name: 📤 push changes
|
||||||
|
run: |
|
||||||
|
git add .
|
||||||
|
git commit -m "chore(release): ${{ steps.bump_version.outputs.BUMPED_VERSION }}"
|
||||||
|
git push origin main
|
||||||
- name: create release
|
- name: create release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
with:
|
with:
|
||||||
name: simulat ${{ github.event.inputs.version }} - ${{ github.event.inputs.description}}
|
name: simulat ${{ steps.bump_version.outputs.BUMPED_VERSION }}
|
||||||
tag_name: ${{ github.event.inputs.version }}
|
tag_name: ${{ steps.bump_version.outputs.BUMPED_VERSION }}
|
||||||
body_path: body.md
|
body_path: release_body.md
|
||||||
prerelease: ${{ github.event.inputs.pre_release }}
|
prerelease: ${{ github.event.inputs.bump_type_pre_release != 'release' }}
|
||||||
discussion_category_name: 'Announcements'
|
discussion_category_name: 'Announcements'
|
||||||
- name: 🧹 cleanup
|
- name: 🧹 cleanup
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user