Update repo index (x86_64) #1332
This file contains 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: Update repo index (x86_64) | |
on: | |
push: | |
branches: | |
- "gh-pages" | |
workflow_dispatch: | |
schedule: | |
- cron: "45 */1 * * *" | |
jobs: | |
update-index: | |
name: Generate index | |
runs-on: ubuntu-latest | |
container: archlinux | |
steps: | |
- name: Install dependencies and update | |
run: pacman -Syu --noconfirm --noprogressbar --needed base-devel git | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: Create repo files | |
run: | | |
mkdir -p x86_64 | |
rm -rf x86_64/unicom-studio.* | |
find x86_64 -name "*.pkg.*" -exec repo-add -R x86_64/unicom-studio.db.tar.gz {} \; | |
- name: Generate index | |
run: | | |
for DIR in $(find "." -not -path "./.git/*" -type d); do | |
{ | |
echo -e '<html>\n<body>\n<h1>目录列表: '$DIR'</h1>\n<hr/>\n<pre>' | |
ls -1pa "$DIR" | grep -v "^\.$" | grep -v "^index\.html$" | awk '{ printf "<a href=\"%s\">%s</a>\n",$1,$1 }' | |
echo -e '</pre>\n</body>\n</html>' | |
} > "$DIR"/index.html | |
done | |
- name: Deploy new index | |
run: | | |
git config --global --add safe.directory "*" | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
if git diff --cached --quiet; then | |
echo "No changes detected. Skipping commit." | |
else | |
git commit -m "🐳 chore(pkg): update package index" | |
git push | |
fi |