| 1 |
name: Publish |
| 2 |
on: |
| 3 |
push: |
| 4 |
tags: |
| 5 |
- '*' |
| 6 |
jobs: |
| 7 |
build: |
| 8 |
runs-on: ubuntu-latest |
| 9 |
permissions: |
| 10 |
contents: read |
| 11 |
outputs: |
| 12 |
artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }} |
| 13 |
steps: |
| 14 |
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 15 |
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 |
| 16 |
with: |
| 17 |
python-version: '3.x' |
| 18 |
cache: pip |
| 19 |
cache-dependency-path: requirements*/*.txt |
| 20 |
# Use the commit date instead of the current date during the build. |
| 21 |
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV |
| 22 |
- name: Create dist |
| 23 |
run: | |
| 24 |
python -m pip install -U pip |
| 25 |
pip install tox |
| 26 |
tox -e makedist |
| 27 |
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 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 |
# Wait for approval before attempting to upload to PyPI. This allows reviewing the |
| 50 |
# files in the draft release. |
| 51 |
environment: |
| 52 |
name: publish |
| 53 |
url: https://pypi.org/project/Flask-Security/${{ github.ref_name }} |
| 54 |
runs-on: ubuntu-latest |
| 55 |
permissions: |
| 56 |
id-token: write |
| 57 |
steps: |
| 58 |
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 59 |
with: |
| 60 |
artifact-ids: ${{ needs.build.outputs.artifact-id }} |
| 61 |
path: dist/ |
| 62 |
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 |
| 63 |
with: |
| 64 |
packages-dir: dist/ |