name: Bump version on: workflow_dispatch: inputs: description: description: 'Release description' required: true bump_type: type: choice description: 'Bump type' options: - none (pre-release only) - major - minor - patch required: true bump_type_pre_release: type: choice description: 'Pre-release type' options: - release - alpha - beta - rc - post - dev required: true env: GH_TOKEN: ${{ secrets.GH_TOKEN }} jobs: create_version: runs-on: ubuntu-latest name: Create version from tag steps: - name: GH_TOKEN if: env.GH_TOKEN == '' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV - name: ๐Ÿ”€ checkout uses: actions/checkout@v4 with: fetch-depth: 0 token: "${{ env.GH_TOKEN }}" - name: ๐Ÿ python uses: actions/setup-python@v5 with: python-version: '3.x' cache: pip - name: ๐Ÿ“ฆ install required utilities run: | pip install git-cliff hatch --break-system-packages - name: configure git run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - name: ๐Ÿ“ฆ bump version id: bump_version run: | if [ "${{ github.event.inputs.bump_type }}" == "none (pre-release only)" ]; then hatch version ${{ github.event.inputs.bump_type_pre_release }} 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 run: | git-cliff -s header --unreleased -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > release_body.md git-cliff -t ${{ steps.bump_version.outputs.BUMPED_VERSION }} > CHANGELOG.md - name: ๐Ÿ“ค push changes run: | git add CHANGELOG.md */__init__.py git commit -m "chore(release): ${{ steps.bump_version.outputs.BUMPED_VERSION }}" git push origin main - name: create release uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} with: name: ${{ github.event.repository.name }} ${{ steps.bump_version.outputs.BUMPED_VERSION }} tag_name: ${{ steps.bump_version.outputs.BUMPED_VERSION }} body_path: release_body.md prerelease: ${{ github.event.inputs.bump_type_pre_release != 'release' }} discussion_category_name: 'Announcements' - name: ๐Ÿงน cleanup run: | rm release_body.md - name: ๐Ÿ“ค merge into develop run: | git checkout develop git merge main --no-ff git push origin develop - name: โœ… done run: echo "done"