chore(ci): Renamed periodic workflow to schedule #1
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: Schedule | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0,6,12,18 * * *' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release_check: | |
name: Release Check | |
runs-on: ubuntu-latest | |
container: archlinux:base-devel | |
timeout-minutes: 5 | |
outputs: | |
list: ${{ steps.releases.outputs.list_updates }} | |
steps: | |
- name: Update system and install dependencies | |
run: | | |
pacman-key --init | |
pacman -Syu --noconfirm fd jq wget | |
- name: Download bumper binary | |
run: | | |
cd $HOME | |
wget 'https://github.com/bcyran/bumper/releases/download/v1.0.0/bumper-1.0.0-linux-amd64.tar.gz' | |
tar xf bumper-1.0.0-linux-amd64.tar.gz | |
chmod +x bumper | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Check for new releases | |
id: releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: sh | |
run: | | |
updates=() | |
for dir in $(fd --type d --exclude jackett --exclude blockify-git --exclude="*-git") | |
do | |
pushd ${dir%/} | |
result=$(${HOME}/bumper --bump=false | grep -i → | wc -l) | |
if [ $result = 1 ]; then | |
updates+=("${dir%/}") | |
fi | |
popd | |
done | |
echo "list_updates=$(jq -cn '$ARGS.positional' --args "${updates[@]}")" >> $GITHUB_OUTPUT | |
build: | |
name: Build | |
needs: release_check | |
runs-on: ubuntu-latest | |
container: archlinux:base-devel | |
if: needs.release_check.outputs.list != '[]' | |
strategy: | |
matrix: | |
package: ${{ fromJson(needs.release_check.outputs.list) }} | |
fail-fast: false | |
steps: | |
- name: Test | |
run: | | |
echo ${{ matrix.package }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Update system and install dependencies | |
run: | | |
pacman-key --init | |
pacman -Syu --noconfirm | |
pacman -S --noconfirm --needed git fd jq namcap | |
- name: Create user to run makepkg | |
run: | | |
useradd -m dev | |
echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/01_dev | |
- name: chown for dev | |
run: | | |
chown -R dev: . | |
- name: Initialize gpg keyring | |
run: | | |
runuser -u dev -- gpg --list-keys | |
- name: Install yay | |
run: | | |
runuser -u dev -- git clone https://aur.archlinux.org/yay.git | |
cd yay | |
runuser -u dev -- makepkg -csri --noconfirm | |
- name: Install package dependencies from AUR | |
run: | | |
cd ${{ matrix.package }} | |
pacman -Ssq > pkglist | |
source PKGBUILD | |
echo ${depends[@]} ${makedepends[@]} ${checkdepends[@]} | |
packages=() | |
for dep in ${depends[@]} ${makedepends[@]} ${checkdepends[@]} | |
do | |
count=0 | |
while IFS="" read -r p || [ -n "$p" ] | |
do | |
if [ $p == $dep ] | |
then | |
count=$((count+1)) | |
fi | |
done < pkglist | |
if [ $count -eq 0 ] | |
then | |
packages+=("${dep}") | |
echo "Added $dep" | |
fi | |
done | |
echo ${packages[@]} | |
runuser -u dev -- yay -S --noconfirm --asdeps ${packages[@]} | |
- name: Build and install package | |
run: | | |
cd ${{ matrix.package }} | |
runuser -u dev -- makepkg -csri --noconfirm | |