linkchecker/.github/workflows/release-files.yml
Chris Mayo 0c9b98deb5 Fix release workflow publish step
gh-action-pypi-publish failing on twine check:

 Checking dist/LinkChecker-10.3.0-py3-none-any.whl.crt: ERROR    InvalidDistribution: Unknown distribution format:
         'LinkChecker-10.3.0-py3-none-any.whl.crt'
2023-09-25 19:22:19 +01:00

65 lines
1.7 KiB
YAML

name: Create distribution files for a new release
on:
release:
types: [released]
jobs:
run:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
# Needed for hatch-vcs to extract LinkChecker version from tag
# https://github.com/actions/checkout/issues/249
with:
fetch-depth: 0
- name: Install Ubuntu packages
run: sudo apt install git
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Python packages
run: >
pip3 install -U hatchling hatch-vcs polib twine
- name: Set SOURCE_DATE_EPOCH
run: >
echo "SOURCE_DATE_EPOCH=$(git log -n 1 ${{ github.sha }} --format=%ct)" >> $GITHUB_ENV
- name: Create distribution files
run: >
python3 -m hatchling build
- name: Generate Sigstore signatures
uses: sigstore/gh-action-sigstore-python@9310933b45d7dfc2fe40c1d701ac114548c28d31
with:
inputs: dist/*
- name: Check distribution files
run: >
twine check dist/*.{tar.gz,whl}
- name: Calculate checksums for distribution files
run: >
sha256sum dist/*.{tar.gz,whl}
- name: Add files to release
run: >
gh release upload ${{ github.ref_name }} dist/*
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Remove Sigstore files
run: >
rm -f dist/*.{crt,sig,sigstore}
- name: Publish distribution files to PyPI
uses: pypa/gh-action-pypi-publish@release/v1