Python Release #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | ||
name: Python Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Specify version (optional)' | ||
required: false | ||
default: '' | ||
python-version: | ||
description: 'Python version to use' | ||
required: false | ||
default: '3.11' | ||
poetry_version_options: | ||
description: 'Poetry version bump (e.g., patch, minor, major)' | ||
required: false | ||
default: 'patch' | ||
poetry_build_params: | ||
description: 'Additional poetry build parameters' | ||
required: false | ||
default: '' | ||
pytest_run: | ||
description: 'Run pytest (true/false)' | ||
required: true | ||
type: boolean | ||
default: true | ||
pytest_params: | ||
description: 'Parameters for pytest' | ||
required: false | ||
default: '--maxfail=3 -v' | ||
jobs: | ||
show-params: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Input parameters | ||
run: | | ||
echo "Input parameters:" >> $GITHUB_STEP_SUMMARY | ||
echo "Version: ${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Python version: ${{ github.event.inputs.python-version }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Poetry version options: ${{ github.event.inputs.poetry_version_options }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Poetry build parameters: ${{ github.event.inputs.poetry_build_params }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Pytest run: ${{ github.event.inputs.pytest_run }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Pytest parameters: ${{ github.event.inputs.pytest_params }}" >> $GITHUB_STEP_SUMMARY | ||
check-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Check if tag exists | ||
if: ${{ inputs.version != '' }} | ||
id: check_tag | ||
uses: netcracker/qubership-workflow-hub/actions/tag-checker@main | ||
with: | ||
tag: 'v${{ github.event.inputs.version }}' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Output result | ||
if: ${{ inputs.version != '' }} | ||
run: | | ||
echo "Tag exists: ${{ steps.check_tag.outputs.exists }}" | ||
echo "Tag name: v${{ github.event.inputs.version }}" | ||
- name: Fail if tag exists | ||
if: inputs.version != '' && steps.check_tag.outputs.exists == 'true' | ||
run: | | ||
echo "Tag already exists: v${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Tag already exists: v${{ github.event.inputs.version }}" | ||
exit 1 | ||
publish: | ||
needs: [check-tag] | ||
uses: netcraker/qubership-workflow-hub/.github/workflows/python-publish.yml@main | ||
Check failure on line 78 in .github/workflows/python-release.yml GitHub Actions / .github/workflows/python-release.ymlInvalid workflow file
|
||
with: | ||
version: ${{ inputs.version }} | ||
poetry_version_options: ${{ inputs.poetry_version_options }} | ||
python-version: ${{ inputs.python-version }} | ||
poetry_build_params: ${{ inputs.poetry_build_params }} | ||
pytest_run: ${{ inputs.pytest_run }} | ||
pytest_params: ${{ inputs.pytest_params }} | ||
secrets: | ||
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
get-current-version: | ||
needs: [publish] | ||
outputs: | ||
current_version: ${{ steps.get_version.outputs.CURRENT_VERSION }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Get current version | ||
id: get_version | ||
run: | | ||
echo CURRENT_VERSION=$(grep -e '^version =' pyproject.toml | cut -d'=' -f2) >> $GITHUB_OUTPUT | ||
# echo CURRENT_VERSION=$(poetry version | cut -d' ' -f2) >> $GITHUB_OUTPUT | ||
- name: Output current version | ||
run: | | ||
echo "Released version: ${{ steps.get_version.outputs.CURRENT_VERSION }}" >> $GITHUB_STEP_SUMMARY | ||
github-release: | ||
needs: [get-current-version] | ||
uses: Netcracker/qubership-workflow-hub/.github/workflows/release-drafter.yml@main | ||
with: | ||
version: ${{ needs.get-current-version.outputs.current_version }} | ||
publish: false |