rename thumbnail files #2261
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: chemotion_saurus GitHub Actions | |
on: | |
push: | |
jobs: | |
build_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Download YT Thumbnails | |
run: | | |
for file in $(grep -roP 'youtube-nocookie.com/embed/.{11}' docs | rev | cut -d / -f 1 | rev); do | |
if [ ! -f "static/img/yt_thumbnails/$file.jpg" ]; then | |
wget -O "static/img/yt_thumbnails/$file.jpg" "https://img.youtube.com/vi/$file/hqdefault.jpg" || wget -O "static/img/yt_thumbnails/$file.jpg" "https://img.youtube.com/vi/$file/0.jpg" | |
fi | |
done | |
- name: Build | |
id: build | |
run: | | |
npm install -g npm | |
npm install | |
npm run build | |
- name: Deploy | |
if: steps.build.outcome == 'success' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'skip deploy') | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
run: | | |
#!/usr/bin/env bash | |
set -euo pipefail | |
eval $(ssh-agent -s); | |
mkdir ~/.ssh/ | |
chmod 700 ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-add ~/.ssh/id_rsa | |
touch ~/.ssh/known_hosts | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
chmod 600 ~/.ssh/known_hosts | |
rsync -e "ssh -o StrictHostKeyChecking=no" -az --delete ./build/ [email protected]:docs/chemotion_saurus/. |