Skip to content

Serve directly the Starlette StaticFiles app #4

Serve directly the Starlette StaticFiles app

Serve directly the Starlette StaticFiles app #4

Workflow file for this run

name: Build Next project, Python module and publish to Pypi
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 10
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
- name: Install dependencies
run: yarn install
# Cache build during CI: https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions
- name: Cache Next build
uses: actions/cache@v4
with:
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
path: |
${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Build Next site
run: CI=false yarn build # Using CI=false remove Treat warning as error that make the compilation fail
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Hatch
run: pip install hatch
- name: Build Python module
run: hatch build
- name: Publish package distributions to PyPI
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
uses: pypa/gh-action-pypi-publish@release/v1