Skip to content

Removed notebook deployment #23

Removed notebook deployment

Removed notebook deployment #23

Workflow file for this run

name: Build and Deploy Stlite
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
target: ["mountable"]
env:
python-version: "3.10"
# 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@v3
## Set up Python and Poetry environment
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
# The following steps are based on https://github.com/python-poetry/poetry/blob/def1ee8f3ae00c307ca028da53d2347615c5c32b/.github/workflows/main.yml#L51-L84
- name: Get full Python version
id: full-python-version
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
- name: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python - -y
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: timeout 10s pip --version || rm -rf .venv
## Set up Node environment
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: 'yarn'
## Set up apt packages. Ref: https://github.com/streamlit/streamlit/wiki/Contributing#ubuntu
- name: Install Streamlit build dependencies
run: sudo apt install protobuf-compiler
- 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: make mountable
- if: matrix.target == 'mountable'
name: Upload the built files as an artifact
uses: actions/upload-artifact@v3
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
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/download-artifact@v3
with:
name: stlite-mountable
path: mountable
- name: Set the build artifact paths
run: |
mkdir -p /tmp/website
cp -r ./mountable/* /tmp/website/.
mv /tmp/website/asset-manifest.json /tmp/website/manifest.json
# Deploying to Firebase
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_HOSTING_DEPLOY_SA }}'
channelId: live
projectId: fusion-217032465111
target: cdf-stlite-prod