Skip to content

Bump and pin pypa/gh-action-pypi-publish action #8

Bump and pin pypa/gh-action-pypi-publish action

Bump and pin pypa/gh-action-pypi-publish action #8

Workflow file for this run

name: releasing
on:
push:
tags:
- "v*"
jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check tag version
run: |
.github/bin/check-version.sh "${GITHUB_REF#refs/tags/v}"
build:
needs: check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: "poetry"
- name: Build package
run: |
poetry build
- name: Extract changelog
run: |
.github/bin/extract-changelog.py ${{ github.ref_name }} /tmp/changelog.md
- uses: actions/upload-artifact@v4
name: Upload build artifacts
with:
name: wheel
retention-days: 7
path: ./dist/*.whl
- uses: actions/upload-artifact@v4
name: Upload changelog
with:
name: changelog
retention-days: 7
path: /tmp/changelog.md
release:
needs: build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
- name: Draft release
run: >-
gh release create
--draft
--repo ${{ github.repository }}
--title ${{ github.ref_name }}
--notes-file changelog/changelog.md
${{ github.ref_name }}
wheel/*
env:
GH_TOKEN: ${{ github.token }}
publish:
needs: release
environment:
name: pypi
url: https://pypi.org/project/indico-patcher/
runs-on: ubuntu-22.04
permissions:
contents: write
id-token: write
steps:
- uses: actions/download-artifact@v4
- name: Publish package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9.0
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: wheel/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9.0
with:
packages-dir: wheel/
- name: Publish release
run: >-
gh release edit
--draft=false
--repo ${{ github.repository }}
${{ github.ref_name }}
env:
GH_TOKEN: ${{ github.token }}