-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add Podman & Podman Desktop documentation #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8c6825f
27eeff2
0646097
c9c729f
99f2c9f
37d77af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: Convert images to AVIF | ||
|
|
||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - main | ||
| paths: | ||
| - "static/images/**" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| convert: | ||
| name: PNG/JPG to AVIF | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install avifenc | ||
| run: sudo apt-get update -y && sudo apt-get install -y libavif-apps | ||
|
Comment on lines
+20
to
+21
|
||
|
|
||
| - name: Convert and update references | ||
| id: convert | ||
| run: | | ||
| changed=false | ||
| sed_script="$(mktemp)" | ||
|
|
||
| while IFS= read -r -d '' f; do | ||
| [ -f "$f" ] || continue | ||
| dir="$(dirname "$f")" | ||
| name="$(basename "${f%.*}")" | ||
| outfile="${dir}/${name}.avif" | ||
|
|
||
| if avifenc -q 80 -s 6 "$f" "$outfile"; then | ||
| rm "$f" | ||
| # Build static-relative paths for markdown reference replacement | ||
| rel_src="${f#static}" | ||
| rel_dst="${outfile#static}" | ||
| # Escape regex metacharacters (. [ \ * ^ $) in the source path | ||
| esc_src="$(printf '%s\n' "$rel_src" | sed 's/[.[\*^$]/\\&/g')" | ||
| # Accumulate substitutions; apply in one pass after the loop | ||
| printf 's|%s|%s|gI\n' "$esc_src" "$rel_dst" >> "$sed_script" | ||
| changed=true | ||
|
Comment on lines
+41
to
+44
|
||
| echo "Converted: $f" | ||
| else | ||
| echo "Failed to convert: $f, skipping." >&2 | ||
| fi | ||
| done < <(find static/images -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" \) -print0) | ||
|
|
||
| # Single pass over all markdown files with all substitutions at once | ||
| if [ "$changed" = "true" ]; then | ||
| find content -name "*.md" -exec sed -i -f "$sed_script" {} + | ||
| fi | ||
| rm -f "$sed_script" | ||
|
|
||
| echo "changed=$changed" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Commit converted images | ||
| if: steps.convert.outputs.changed == 'true' | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add static/images/ content/ | ||
| git commit -m "chore: auto-convert images to AVIF" | ||
| git push | ||
Uh oh!
There was an error while loading. Please reload this page.