Skip to content

fix(ci): Add category #41

fix(ci): Add category

fix(ci): Add category #41

# Python Releasing Workflow
name: Python - Release
on:
push:
workflow_call:
inputs:
version:
description: 'Python main version to vendor'
type: string
# All Major versions of Python that are currently supported
default: '3.11'
permissions:
contents: write
pull-requests: write
jobs:
version-changes:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.check_release.outputs.release }}
version: ${{ steps.check_release.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: "Check release"
id: check_release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
if [[ -f .release.yml ]]; then
pip install yq
current_version=$(cat .release.yml | yq -r ".version")
elif [[ -f pyproject.toml ]]; then
current_version=$(grep -oP '^version = "(.*)"$' pyproject.toml | cut -d '"' -f 2)
elif [[ -f setup.py ]]; then
current_version=$(grep -oP '^__version__ = "(.*)"$' setup.py | cut -d '"' -f 2)
else
echo "No version file found"
current_version="NA"
fi
released_version=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/:owner/:repo/releases/latest | jq -r ".tag_name")
if [[ "$current_version" == "NA" || "$current_version" == "$released_version" ]]; then
echo "No new release found"
echo "release=false" >> "$GITHUB_OUTPUT"
else
echo "New release found"
echo "version=$current_version" >> "$GITHUB_OUTPUT"
echo "release=true" >> "$GITHUB_OUTPUT"
fi
github-release:
uses: advanced-security/reusable-workflows/.github/workflows/[email protected]
needs: [ version-changes ]
if: ${{ needs.version-changes.outputs.release == 'true' }}
secrets: inherit
with:
version: ${{ needs.version-changes.outputs.version }}