Add scheduler workflow

This commit is contained in:
marcosfad 2022-03-29 22:20:02 +02:00
parent d2d1c37fff
commit c5f4291ff3
2 changed files with 34 additions and 2 deletions

View File

@ -10,8 +10,14 @@ on:
type: string
default: ''
description: (optional) Choose kernel version to use from T2Linux. Without the "v".
workflow_call:
inputs:
KERNEL_VERSION:
required: true
type: string
env:
KERNEL_VERSION: ${{ github.event.inputs.KERNEL_VERSION }}
KERNEL_VERSION: ${{ github.event.inputs.KERNEL_VERSION || inputs.KERNEL_VERSION }}
jobs:
build:
@ -26,7 +32,7 @@ jobs:
run: |
if [ -z "${KERNEL_VERSION}" ]; then
echo "KERNEL_VERSION not set, calculating it"
KERNEL_VERSION=$(curl -Ls https://github.com/t2linux/T2-Ubuntu-Kernel/releases/ | grep deb | grep download | grep "${MBP_VERSION}" | cut -d'/' -f6 | head -n1 | cut -d'v' -f2)
KERNEL_VERSION=$(curl -Ls https://github.com/t2linux/T2-Ubuntu-Kernel/releases/ | grep deb | grep download | cut -d'/' -f6 | head -n1 | cut -d'v' -f2)
fi
echo "::set-output name=build::${KERNEL_VERSION}"

26
.github/workflows/auto-update.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
---
name: CI
# yamllint disable-line rule:truthy
on:
schedule:
- cron: '0 0 * * *'
jobs:
check-update:
runs-on: ubuntu-latest
outputs:
update_available: ${{ steps.variables.outputs.update_available }}
latest_kernel: ${{ steps.variables.outputs.update_available }}
steps:
- name: Configure variables
id: variables
run: |
LATEST_KERNEL_VERSION=$(curl -Ls https://github.com/t2linux/T2-Ubuntu-Kernel/releases/ | grep deb | grep download | grep "${MBP_VERSION}" | cut -d'/' -f6 | head -n1 | cut -d'v' -f2)
curl -Ls https://github.com/marcosfad/mbp-ubuntu/releases | grep zip | grep download | grep "${KERNEL_VERSION}" | cut -d'/' -f6 && REQUIRE_BUILD="false" || REQUIRE_BUILD="true"
echo "::set-output name=update_available::${REQUIRE_BUILD}"
echo "::set-output name=latest_kernel::${LATEST_KERNEL_VERSION}"
trigger-build:
needs: ['check-update']
uses: ./.github/workflows/CI.yml
if: ${{ needs.check-update.outputs.update_available == true }}
with:
KERNEL_VERSION: ${{ needs.check-update.outputs.latest_kernel }}