Check Update of Packages #2054
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: Check Update of Packages | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
- cron: '0 3,6,9,12,15,18,21 * * *' | |
workflow_dispatch: | |
inputs: | |
package: | |
description: 'package to check' | |
jobs: | |
updatecheck: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/eweos/docker:master | |
steps: | |
- name: Update Repository and install rollmeow | |
run: pacman -Sy && pacman -S --noconfirm lua54-curl rollmeow wget git jq | |
- name: Restore cache | |
run: | | |
wget https://raw.githubusercontent.com/eweOS/workflow/updatecheck/rollmeow.cache.lua -O /tmp/rollmeow.cache.lua || rm -f /tmp/rollmeow.cache.lua || true | |
- name: Clone config | |
run: | | |
mkdir -p ~/.config | |
git clone https://github.com/eweOS/updatecheck ~/.config/rollmeow | |
- name: Check for updates (all) | |
if: ${{ github.event.inputs.package == '' || github.event.schedule == '0 0 * * *' }} | |
run: rollmeow --sync --verbose | |
- name: Check for updates (single) | |
if: ${{ github.event.inputs.package != '' }} | |
run: rollmeow --sync --verbose ${{ github.event.inputs.package }} | |
- name: Collect result | |
run: | | |
mkdir -p ~/checkresult | |
rollmeow --json > ~/checkresult/results.json | |
cp /tmp/rollmeow.cache.lua ~/checkresult/ | |
- name: Generate list of unconfigured packages | |
run: | | |
pacman -Slq main | xargs -I @ bash -c "jq -e 'any(.name==\"@\")' ~/checkresult/results.json >/dev/null || echo @" | awk '{ print "\""$0"\""}' | jq -s '.' > ~/checkresult/unconfigured.json | |
- name: Deploy result | |
run: | | |
cd ~/checkresult | |
git init | |
git config --global user.name 'eweOS Update Checker' | |
git config --global user.email '[email protected]' | |
git add results.json | |
git add unconfigured.json | |
git add rollmeow.cache.lua | |
git remote add github https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/eweOS/workflow | |
git commit -m "Update package list" | |
git push github HEAD:updatecheck -f |