| 1 |
name: Publish |
| 2 |
on: |
| 3 |
push: |
| 4 |
tags: |
| 5 |
- "*" |
| 6 |
jobs: |
| 7 |
build: |
| 8 |
runs-on: ubuntu-latest |
| 9 |
steps: |
| 10 |
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 11 |
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2 |
| 12 |
with: |
| 13 |
enable-cache: true |
| 14 |
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 |
| 15 |
with: |
| 16 |
python-version: "3.x" |
| 17 |
# Use the commit date instead of the current date during the build. |
| 18 |
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV |
| 19 |
- run: uv build |
| 20 |
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 21 |
with: |
| 22 |
path: ./dist |
| 23 |
create-release: |
| 24 |
needs: [build] |
| 25 |
runs-on: ubuntu-latest |
| 26 |
permissions: |
| 27 |
contents: write |
| 28 |
steps: |
| 29 |
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 30 |
with: |
| 31 |
name: artifact |
| 32 |
path: artifact/ |
| 33 |
- name: create release |
| 34 |
run: > |
| 35 |
gh release create --draft --repo ${{ github.repository }} |
| 36 |
${{ github.ref_name }} artifact/* |
| 37 |
env: |
| 38 |
GH_TOKEN: ${{ github.token }} |
| 39 |
publish-pypi: |
| 40 |
needs: [build] |
| 41 |
# Wait for approval before attempting to upload to PyPI. This allows reviewing the |
| 42 |
# files in the draft release. |
| 43 |
environment: |
| 44 |
name: publish |
| 45 |
url: https://pypi.org/project/Flask-Caching/${{ github.ref_name }} |
| 46 |
runs-on: ubuntu-latest |
| 47 |
permissions: |
| 48 |
id-token: write |
| 49 |
steps: |
| 50 |
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 51 |
with: |
| 52 |
name: artifact |
| 53 |
path: artifact/ |
| 54 |
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 |
| 55 |
with: |
| 56 |
repository-url: https://test.pypi.org/legacy/ |
| 57 |
packages-dir: artifact/ |
| 58 |
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 |
| 59 |
with: |
| 60 |
packages-dir: artifact/ |