Skip to content

Deploy to GitHub Pages #4

Deploy to GitHub Pages

Deploy to GitHub Pages #4

Workflow file for this run

name: Deploy to GitHub Pages
on: workflow_dispatch
env:
HATCH_VERSION: "1.7.0"
PYTHON_VERSION: "3.10"
DATALOGGER_JUPYTERLAB_VERSION: "0.1.0"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Hatch
run: pipx install hatch==$HATCH_VERSION
- name: Set up Python with pip cache
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Yarn cache
uses: actions/cache@v3
with:
path: .yarn/cache
key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-${{ runner.os }}-
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: yarn
- name: Build frontend
run: yarn build:lib
- name: Build lab extension
run: hatch run jupyterlab:build
- name: Build package
run: hatch build
- name: Create _site/releases/index.html
run: |
mkdir _site
mkdir _site/releases
echo '<!DOCTYPE html>
<html>
<body>
<a href="datalogger-jupyterlab/">datalogger-jupyterlab</a>
</body>
</html>' > _site/releases/index.html
- name: Create _site/releases/datalogger-jupyterlab/index.html
run: |
mkdir _site/releases/datalogger-jupyterlab
echo '<!DOCTYPE html>
<html>
<body>
<a href="datalogger_jupyterlab-${{ env.DATALOGGER_JUPYTERLAB_VERSION }}-py3-none-any.whl">
datalogger_jupyterlab-${{ env.DATALOGGER_JUPYTERLAB_VERSION }}-py3-none-any.whl
</a>
<a href="datalogger_jupyterlab-${{ env.DATALOGGER_JUPYTERLAB_VERSION }}.tar.gz">datalogger_jupyterlab-${{ env.DATALOGGER_JUPYTERLAB_VERSION }}.tar.gz</a>
</body>
</html>' > _site/releases/datalogger-jupyterlab/index.html
- name: Move package files into _site/releases/datalogger-jupyterlab
run: mv dist/* _site/releases/datalogger-jupyterlab
- name: Upload site artifact
uses: actions/upload-pages-artifact@v1
deploy:
needs: build
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@v2