Skip to content

amend test image

amend test image #38

Workflow file for this run

name: deploy
# Deploy the site to GitHub Pages
on:
push:
branches: ["main"]
paths-ignore:
- '.github/**'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
thumbnails:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if we need to generate thumbnails
id: check_changes
run: |
if ! git diff --name-only HEAD^ HEAD | grep -q "assets/images/fulls/"; then
echo "No changes detected in assets/images/fulls/, skipping thumbnail generation"
echo "changes_detected=false" >> $GITHUB_OUTPUT
fi
echo "Changes detected in assets/images/fulls/, generating thumbnails"
echo "changes_detected=true" >> $GITHUB_OUTPUT
- name: Install FUSE and ImageMagick 7
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
sudo apt-get update
sudo apt-get install -y fuse
wget -q https://imagemagick.org/archive/binaries/magick
chmod +x magick
sudo mv magick /usr/local/bin/
magick -version
- name: Create thumbs directory if not exists
if: steps.check_changes.outputs.changes_detected == 'true'
run: mkdir -p assets/images/thumbs
- name: Generate thumbnails
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
rm assets/images/thumbs/* # Remove outdated thumbnails to ensure newly generated ones reflect the latest full-size images
for img in assets/images/fulls/*.jpg; do
filename=$(basename "$img")
magick "$img" -resize "500x" "assets/images/thumbs/$filename"
done
- name: Generate Image List
id: generate-list
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
{
echo "[//]: # (This file is managed by the update_image_archive_list.yml GitHub Action. Changes will be overwritten.)"
echo "# Image Archive Gallery"
echo ""
echo "Thank you for taking the time to view our gallery, exploring some of the photographic history of our band. We hope you enjoy the images of our band members and performances."
echo ""
for img in $(ls assets/images/fulls); do
thumb="https://efpb.org/assets/images/thumbs/$img"
full="https://efpb.org/assets/images/fulls/$img"
echo "- [![$img]($thumb)]($full)"
done
echo ""
echo "Return to the [Main Gallery](https://efpb.org)"
echo ""
} > archive/README.md
- name: Commit and push if changed
if: steps.check_changes.outputs.changes_detected == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add assets/images/thumbs/
git add archive/README.md
git diff --quiet && git diff --staged --quiet || (git commit -m "Generate thumbnails" && git push)
build:
needs: thumbnails
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check markdown files have corresponding images
run: |
# Check if each markdown file has a corresponding full-size image
for md_file in _images/*.md; do
base_name=$(basename "$md_file" .md)
if [ ! -f "assets/images/fulls/$base_name.jpg" ]; then
echo "Error: Missing image for $md_file"
echo "Expected: assets/images/fulls/$base_name.jpg"
echo "Please ensure that all _images/*.md files have corresponding images in assets/images/fulls/"
exit 1
fi
done
# Check if each markdown file has a corresponding thumbnail image
for md_file in _images/*.md; do
base_name=$(basename "$md_file" .md)
if [ ! -f "assets/images/thumbs/$base_name.jpg" ]; then
echo "Error: Missing thumbnail for $md_file"
echo "Expected: assets/images/thumbs/$base_name.jpg"
echo "Please ensure that all _images/*.md files have corresponding thumbnails in assets/images/thumbs/"
exit 1
fi
done
# Check if each image has a corresponding markdown file
for img_file in assets/images/fulls/*.jpg; do
base_name=$(basename "$img_file" .jpg)
if [ ! -f "_images/$base_name.md" ]; then
echo "⚠️ Warning: Missing markdown file for $img_file"
echo "Expected: _images/$base_name.md"
echo "If you want the image to be displayed, please ensure that it has a corresponding markdown file in _images/"
echo "This will not break the build, but the image will not be displayed on the main gallery"
fi
done
echo "✅ All _images markdown files have corresponding full and thumbnail images"
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Install Dependencies
run: |
gem install bundler
bundle install
- name: Build with Jekyll
run: bundle exec jekyll build
env:
JEKYLL_ENV: production
PAGES_REPO_NWO: ${{ github.repository }}
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4