Merge branch 'main' of github.com:langdb/jupyterlite-langdb #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
AWS_REGION: ap-southeast-1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/langdb-files/yarn.lock') }} | |
#---------------------------------------------- | |
# install dependencies | |
#---------------------------------------------- | |
- name: Install dependencies | |
run: | | |
poetry run pip uninstall -y langdb-kernel-lite langdb-files | |
poetry install --no-interaction | |
- name: Build the JupyterLite site | |
run: | | |
cp README.md content | |
sh build.sh | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist | |
- name: Configure AWS Credentials | |
if: github.ref == 'refs/heads/main' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-session-name: deployer | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Deploy jupyterlite to bucket | |
if: github.ref == 'refs/heads/main' | |
run: aws s3 sync ./dist s3://app.dev.langdb.ai/jupyterlite | |
# - name: Invalidate pulse cloudfront | |
# if: github.ref == 'refs/heads/main' | |
# run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/jupyterlite/*" | |
deploy: | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |