Skip to content

Publish Python release from pull_request #5

Publish Python release from pull_request

Publish Python release from pull_request #5

# SPDX-FileCopyrightText: 2026 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.)
# SPDX-License-Identifier: Apache-2.0
name: code-uv-python-release
run-name: Publish Python release from ${{ github.event_name }}
on:
pull_request:
types: [closed]
branches: [main, main-*]
workflow_dispatch:
inputs:
release_type:
description: Release type to use
required: true
default: release-type/minor
type: choice
options:
- release-type/hotfix
- release-type/multi-hotfix
- release-type/major
- release-type/minor
- release-type/patch
permissions:
contents: read
concurrency:
group: code-uv-python-release-${{ github.repository }}-${{ github.event.pull_request.base.ref || github.ref_name }}
cancel-in-progress: false
jobs:
release-core:
name: Prepare and Build Release
if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/code-uv_python-release-core.yml
with:
release_type: ${{ inputs.release_type }}
secrets:
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
RELEASE_GPG_PRIVATE_KEY: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}

Check failure on line 43 in .github/workflows/code-uv_python-release.yml

View workflow run for this annotation

GitHub Actions / code-uv-python-release

Invalid workflow file

The workflow is not valid. .github/workflows/code-uv_python-release.yml (Line: 43, Col: 32): Invalid secret, RELEASE_GPG_PRIVATE_KEY is not defined in the referenced workflow. .github/workflows/code-uv_python-release.yml (Line: 44, Col: 31): Invalid secret, RELEASE_GPG_PASSPHRASE is not defined in the referenced workflow.
RELEASE_GPG_PASSPHRASE: ${{ secrets.RELEASE_GPG_PASSPHRASE }}
publish-pypi:
name: Publish to PyPI
needs: release-core
runs-on: ubuntu-24.04
timeout-minutes: 30
environment: pypi
permissions:
id-token: write
steps:
- name: Download release distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: python-distributions-*
path: dist
merge-multiple: true
- name: Validate trusted publishing boundary
uses: InditexTech/gh-actions/pypi@8a719baa6e8d514ccdfe87cff2baae9007a8b168 # v1.1.5
with:
attestations: 'true'
packages-dir: dist
skip-existing: 'true'
- name: Publish distributions with trusted publishing
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
attestations: 'true'
packages-dir: dist
skip-existing: 'true'
github-release:
name: Create GitHub Release ${{ matrix.release.tag }}
needs: [release-core, publish-pypi]
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
release: ${{ fromJSON(needs.release-core.outputs.releases) }}
steps:
- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
- name: Download release distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-distributions-${{ matrix.release.tag }}
path: dist
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
RELEASE_TAG: ${{ matrix.release.tag }}
RELEASE_VERSION: ${{ matrix.release.version }}
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
assets=(dist/*)
if [[ ${#assets[@]} -eq 0 ]]; then
echo "::error title=Missing distributions::The release artifact is empty."
exit 1
fi
if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then
gh release upload "$RELEASE_TAG" "${assets[@]}" \
--repo "$GITHUB_REPOSITORY" \
--clobber
else
gh release create "$RELEASE_TAG" "${assets[@]}" \
--repo "$GITHUB_REPOSITORY" \
--title "$RELEASE_VERSION" \
--generate-notes
fi