General clean-up, especially around docs, in preparation for v1.0 #1629
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 website | |
on: | |
push: | |
branches: [main] | |
tags: ['v*'] | |
pull_request: | |
# Check all PR | |
jobs: | |
build-website: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# we need the full history to be able to get the chemiscope version with | |
# git describe during the build | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
cache: 'npm' | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: configure access to git repositories in package-lock.json | |
run: git config --global url."https://github.com/".insteadOf ssh://[email protected] | |
- name: install npm dependencies | |
run: npm ci | |
- name: install python dependencies | |
run: python3 -m pip install tox | |
- run: npm run build | |
- run: npm run download-examples | |
- run: tox -e docs | |
- run: tox -e generate-standalone | |
- name: assemble full website | |
run: | | |
cp -r app/ gh-pages/ | |
cp dist/*.min.js gh-pages/ | |
cp chemiscope_standalone.html gh-pages/ | |
cp -r docs/build/html/ gh-pages/docs/ | |
rm -f gh-pages/examples/.gitignore | |
- name: deploy website to gh-pages | |
# only deploy website from main branch | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./gh-pages/ | |
cname: chemiscope.org | |
force_orphan: true | |
- name: upload minified JS to GitHub release | |
# only upload minified JS from tags | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
dist/chemiscope.d.ts | |
dist/chemiscope.min.js | |
dist/molecule-viewer.min.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |