Deploy to GitHub Pages #1
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" | |
PACKAGE_VERSION: "0.1.0" | |
PACKAGE_NAME: "jupyterlab-display-name" | |
PYTHON_PACKAGE_NAME: "jupyterlab_display_name" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Hatch | |
run: pipx install hatch==${{ env.HATCH_VERSION }} | |
- 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="${{ env.PACKAGE_NAME }}/">${{ env.PACKAGE_NAME }}</a> | |
</body> | |
</html>' > _site/releases/index.html | |
- name: Create _site/releases/<package-name>/index.html | |
run: | | |
mkdir _site/releases/${{ env.PACKAGE_NAME }} | |
echo '<!DOCTYPE html> | |
<html> | |
<body> | |
<a href="${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-py3-none-any.whl"> | |
${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-py3-none-any.whl | |
</a> | |
<a href="${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}.tar.gz"> | |
${{ env.PYTHON_PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}.tar.gz | |
</a> | |
</body> | |
</html>' > _site/releases/${{ env.PACKAGE_NAME }}/index.html | |
- name: Move package files into _site/releases/<package-name> | |
run: mv dist/* _site/releases/${{ env.PACKAGE_NAME }} | |
- name: Upload site artifact | |
uses: actions/upload-pages-artifact@v2 | |
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 |