Deploy to GitHub Pages #2
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: 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: 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 |