Skip to content

[ImgBot] Optimize images #38

[ImgBot] Optimize images

[ImgBot] Optimize images #38

Workflow file for this run

name: Spaceships
on:
push:
paths:
- 'majortom/spaceships/pictures/**'
- 'majortom/spaceships.html'
workflow_dispatch:
jobs:
update-gallery:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Generate spaceships.html
run: |
echo "Generating spaceships.html..."
echo '<!DOCTYPE html><html lang="en">' > majortom/spaceships.html
echo '<head>' >> majortom/spaceships.html
echo '<meta charset="UTF-8">' >> majortom/spaceships.html
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">' >> majortom/spaceships.html
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' >> majortom/spaceships.html
echo '<title>Spaceships Gallery</title>' >> majortom/spaceships.html
echo '<link rel="stylesheet" href="https://unpkg.com/nes.css/css/nes.css" />' >> majortom/spaceships.html
echo '<style>' >> majortom/spaceships.html
# Add your CSS here; you could include specific styles for spaceships.html
echo '</style>' >> majortom/spaceships.html
echo '</head><body>' >> majortom/spaceships.html
# Header
echo '<div class="header">' >> majortom/spaceships.html
echo ' <a href="https://brunurb.github.io/"><span class="nes-icon home is-small"></span> brunurb</a>' >> majortom/spaceships.html
echo ' <a href="https://brunurb.github.io/majortom/917.html" class="nes-btn">917</a>' >> majortom/spaceships.html
echo ' <a href="https://brunurb.github.io/majortom/astronaut.html" class="nes-btn">Astronauts</a>' >> majortom/spaceships.html
echo ' <a href="https://brunurb.github.io/majortom/controls.html" class="nes-btn">Controls</a>' >> majortom/spaceships.html
echo ' <a href="https://brunurb.github.io/majortom/planets.html" class="nes-btn">Planets</a>' >> majortom/spaceships.html
echo '</div>' >> majortom/spaceships.html
# Main content with centered text in mosaic div
echo '<main>' >> majortom/spaceships.html
echo '<h1>Spaceships Gallery</h1>' >> majortom/spaceships.html
echo '<div id="myMosaic">' >> majortom/spaceships.html
# Loop to add images inside the myMosaic div
for img in $(ls majortom/spaceships/pictures | grep -E '\.jpeg$|\.jpg$|\.gif$|\.svg$|\.png$|\.webp$'); do
echo "<img src='https://brunurb.github.io/majortom/spaceships/pictures/$img' alt='Gallery Image' data-full='https://brunurb.github.io/majortom/spaceships/pictures/$img' class='thumbnail' onclick='showImage(this.dataset.full)' />" >> majortom/spaceships.html
done
echo '</div>' >> majortom/spaceships.html
echo '<div id="overlay" onclick="closeOverlay(event)">' >> majortom/spaceships.html
echo ' <div class="overlay-content">' >> majortom/spaceships.html
echo ' <span id="close">&times;</span>' >> majortom/spaceships.html
echo ' <img id="overlay-image" src="" alt="Full Size Image" />' >> majortom/spaceships.html
echo ' </div>' >> majortom/spaceships.html
echo '</div>' >> majortom/spaceships.html
echo '</main>' >> majortom/spaceships.html
# Footer
echo '<footer>© <a href="https://brunurb.github.io/">by brunurb</a></footer>' >> majortom/spaceships.html
# Include jQuery and custom scripts
echo '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>' >> majortom/spaceships.html
echo '<script type="text/javascript">' >> majortom/spaceships.html
# Add the Overlay JS functionality here
echo '</script>' >> majortom/spaceships.html
echo '</body></html>' >> majortom/spaceships.html
- name: Commit changes
run: |
git config --local user.email "github-actions@github.com"
git config --local user.name "GitHub Action"
git add majortom/spaceships.html
git commit -m "Regenerate majortom/spaceships.html for gallery" || echo "No changes to commit"
git push origin master # Adjust this if your main branch is something else