| 1 |
name: Publish |
| 2 |
on: |
| 3 |
push: |
| 4 |
tags: ['*'] |
| 5 |
permissions: {} |
| 6 |
concurrency: |
| 7 |
group: publish-${{ github.event.push.ref }} |
| 8 |
cancel-in-progress: true |
| 9 |
jobs: |
| 10 |
build: |
| 11 |
runs-on: ubuntu-latest |
| 12 |
outputs: |
| 13 |
artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} |
| 14 |
steps: |
| 15 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 16 |
with: |
| 17 |
persist-credentials: false |
| 18 |
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 |
| 19 |
with: |
| 20 |
enable-cache: false |
| 21 |
prune-cache: false |
| 22 |
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 23 |
with: |
| 24 |
python-version-file: pyproject.toml |
| 25 |
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV |
| 26 |
- run: uv build |
| 27 |
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 |
| 28 |
id: upload-artifact |
| 29 |
with: |
| 30 |
name: dist |
| 31 |
path: dist/ |
| 32 |
if-no-files-found: error |
| 33 |
create-release: |
| 34 |
needs: [build] |
| 35 |
runs-on: ubuntu-latest |
| 36 |
permissions: |
| 37 |
contents: write |
| 38 |
steps: |
| 39 |
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 40 |
with: |
| 41 |
artifact-ids: ${{ needs.build.outputs.artifact-id }} |
| 42 |
path: dist/ |
| 43 |
- name: create release |
| 44 |
run: gh release create --draft --repo ${GITHUB_REPOSITORY} ${GITHUB_REF_NAME} dist/* |
| 45 |
env: |
| 46 |
GH_TOKEN: ${{ github.token }} |
| 47 |
publish-pypi: |
| 48 |
needs: [build] |
| 49 |
environment: |
| 50 |
name: publish |
| 51 |
url: https://pypi.org/project/Click/${{ github.ref_name }} |
| 52 |
runs-on: ubuntu-latest |
| 53 |
permissions: |
| 54 |
id-token: write |
| 55 |
steps: |
| 56 |
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 57 |
with: |
| 58 |
artifact-ids: ${{ needs.build.outputs.artifact-id }} |
| 59 |
path: dist/ |
| 60 |
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |
| 61 |
with: |
| 62 |
packages-dir: "dist/" |