mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds
63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
name: Create distribution files for a new release
|
|
|
|
on:
|
|
release:
|
|
types: [released]
|
|
|
|
jobs:
|
|
run:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
attestations: write
|
|
contents: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
# Needed for hatch-vcs to extract LinkChecker version from tag
|
|
# https://github.com/actions/checkout/issues/249
|
|
fetch-depth: 0
|
|
show-progress: false
|
|
|
|
- name: Install Ubuntu packages
|
|
run: sudo apt install git
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
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: Attest
|
|
uses: actions/attest-build-provenance@v1
|
|
with:
|
|
subject-path: 'dist/*.{tar.gz,whl}'
|
|
|
|
- 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: Publish distribution files to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|