Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/placeframe. a google timeline → photo EXIF data synchronizer
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112# Simple workflow for deploying static content to GitHub Pagesname: Deploy static content to Pages
on: # Runs on pushes targeting the default branch push: branches: ["main"]
# Allows you to run this workflow manually from the Actions tab workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pagespermissions: contents: read pages: write id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.concurrency: group: "pages" cancel-in-progress: false
jobs: validate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Validate website artifact run: | python3 <<'PY' from html.parser import HTMLParser from pathlib import Path import sys
website = Path("website") required = [ website / "index.html", website / "privacy.html", website / "terms.html", website / "site.css", website / "robots.txt", website / "sitemap.xml", website / "CNAME", website / ".nojekyll", website / "assets" / "favicon.svg", website / "assets" / "placeframe-social.png", ]
missing = [str(path) for path in required if not path.exists()] if missing: print("Missing required files:") for path in missing: print(f" - {path}") sys.exit(1)
class LinkParser(HTMLParser): def __init__(self): super().__init__() self.targets = []
def handle_starttag(self, tag, attrs): attrs = dict(attrs) for key in ("href", "src"): value = attrs.get(key) if value: self.targets.append(value)
broken = [] for html_file in sorted(website.glob("*.html")): parser = LinkParser() parser.feed(html_file.read_text(encoding="utf-8")) for target in parser.targets: if target.startswith(("http://", "https://", "mailto:", "#", "data:")): continue local_target = target.split("?", 1)[0].split("#", 1)[0] if not local_target: continue resolved = (html_file.parent / local_target).resolve() if not resolved.exists(): broken.append(f"{html_file}: {target}")
if broken: print("Broken relative links/assets:") for item in broken: print(f" - {item}") sys.exit(1)
print("Website validation passed.") PY
# Single deploy job since we're just deploying deploy: needs: validate environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Pages uses: actions/configure-pages@v5 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: './website' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v5