This file contains hidden or 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: Generate README previews | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
generate-readmes: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Update Arch and install dependencies | |
run: | | |
pacman -Syu --noconfirm | |
pacman -S --noconfirm git imagemagick wget base-devel pngcrush optipng | |
convert --version | |
- name: Set up Git identity | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global --add safe.directory $GITHUB_WORKSPACE | |
- name: Make scripts executable | |
run: | | |
chmod +x $GITHUB_WORKSPACE/scripts/*.sh | |
- name: Run script to generate READMEs | |
run: | | |
REPO_ROOT="$GITHUB_WORKSPACE" $GITHUB_WORKSPACE/scripts/build-wallpaper-pages.sh | |
- name: Verify generated images | |
run: | | |
cd $GITHUB_WORKSPACE | |
find media/wlp-preview/ -name "*.png" -exec identify -verbose {} \; | head -n 20 | |
echo "Всего сгенерировано: $(find media/wlp-preview/ -name "*.png" | wc -l) изображений" | |
- name: Add changes to Git stage | |
run: | | |
cd $GITHUB_WORKSPACE | |
git add . | |
- name: Commit files | |
run: | | |
cd $GITHUB_WORKSPACE | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Auto-generate wallpaper previews [skip ci]" --allow-empty | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.head_ref }} | |
force_with_lease: true | |