Skip to content

Release

Release #11

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
increment:
type: choice
description: Kind of increment (optional)
options:
- ''
- MAJOR
- MINOR
- PATCH
default: ''
required: false
jobs:
release:
name: Bump version and create changelog with commitizen
runs-on: ubuntu-latest
# IMPORTANT: both environment and the id-token permission are mandatory for trusted publishing
environment: releases
permissions:
id-token: write
steps:
- name: Ensures ref to release pass CI
uses: noirbizarre/need-checks@0.1
with:
workflow: ci.yml
token: ${{ secrets.PAT }}
- name: Clone
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.11"
cache: true
- name: Bump using commitizen
uses: commitizen-tools/commitizen-action@0.21.0
with:
github_token: ${{ secrets.PAT }}
changelog_increment_filename: body.md
extra_requirements: emotional
increment: ${{ github.event.inputs.increment }}
- name: Build artifacts
run: pdm build
- name: Github Release
id: github-release
uses: softprops/action-gh-release@v2
with:
body_path: "body.md"
tag_name: ${{ env.REVISION }}
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Publish on PyPI
run: pdm publish --no-build
- name: Publish summary
run: |
cat body.md >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts" >> $GITHUB_STEP_SUMMARY
echo "- GitHub release: ${{ steps.github-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY
echo "- PyPI release: https://pypi.org/project/pdm-dockerize/${REVISION}/" >> $GITHUB_STEP_SUMMARY