Skip to content

Fix Content-Disposition header parser #3339

Fix Content-Disposition header parser

Fix Content-Disposition header parser #3339

Workflow file for this run

name: Build and Deploy GitHub Pages
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
# https://stackoverflow.com/a/72408109
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
GITHUB_PAGES_SUBDIR_MOUNTABLE: lib/mountable
jobs:
build:
strategy:
matrix:
target: ["mountable"]
env:
# To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory".
# See https://github.com/actions/virtual-environments/issues/70#issuecomment-653886422
# The Linux VM has 7GB RAM (https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources),
# so we set the max memory size as 6.5 GiB like https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
NODE_OPTIONS: "--max-old-space-size=6656"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
## Set up Python
- uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
enable-cache: true
cache-dependency-glob: |
**/requirements*.txt
**/uv.lock
## Set up Node environment
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
- run: yarn install --frozen-lockfile
# We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github
# Actions are running as of 2023.05.03 - doesn't have recent versions
# of protoc in its package repository.
# Ref: https://github.com/streamlit/streamlit/blob/1.23.1/.github/actions/make_init/action.yml#L47-L56
# So we download the precompiled binary from the release page and install it,
# following https://grpc.io/docs/protoc-installation/#install-pre-compiled-binaries-any-os
- name: Install protoc
run: |
curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip
unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local
echo "$HOME/.local/bin" >> $GITHUB_PATH
env:
PB_REL: "https://github.com/protocolbuffers/protobuf/releases"
- name: Set up
run: make init
## Build and deploy @stlite/mountable
# PUBLIC_URL here is set as a relative path, which is possible to the trick introduced at https://github.com/whitphx/stlite/pull/143.
- if: matrix.target == 'mountable'
name: Set PUBLIC_URL
run: echo "PUBLIC_URL=." >> $GITHUB_ENV
- if: matrix.target == 'mountable'
name: Build @stlite/mountable
run: |
. .venv/bin/activate
make mountable
- if: matrix.target == 'mountable'
name: Upload the built files as an artifact
uses: actions/upload-artifact@v4
with:
name: stlite-mountable
path: packages/mountable/build
deploy:
needs: build
runs-on: ubuntu-latest
# Settings for GitHub pages deployment, ref: https://github.com/peaceiris/actions-gh-pages#getting-started
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: stlite-mountable
path: mountable
- name: Configure redirect
run: |
mkdir -p /tmp/website/
cat << _EOT_ > /tmp/website/_config.yml
plugins:
- jekyll-redirect-from
_EOT_
cat << _EOT_ > /tmp/website/index.html
---
redirect_to: "https://edit.share.stlite.net/"
---
_EOT_
cp /tmp/website/index.html /tmp/website/404.html
- name: Set the build artifact paths
run: |
mkdir -p /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE}
cp -r ./mountable/* /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE}/.
- name: Upload the website files as an artifact
uses: actions/upload-artifact@v4
if: ${{ github.ref != 'refs/heads/main' }}
with:
name: website
path: /tmp/website
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: /tmp/website
enable_jekyll: true