浏览代码

Add workflow for weekly update checks

This change adds a workflow that will check weekly whether a new release
is available for the current actively maintained Linux stable branches.
Fabian Mastenbroek 5 年之前
父节点
当前提交
ed0d145cdc
共有 2 个文件被更改,包括 61 次插入0 次删除
  1. 51 0
      .github/workflows/watch.yml
  2. 10 0
      scripts/check.sh

+ 51 - 0
.github/workflows/watch.yml

@@ -0,0 +1,51 @@
+name: Kernel Watch
+
+on:
+  workflow_dispatch:
+  schedule:
+    - cron: '0 14 * * 1' # Every week
+
+jobs:
+  check:
+    name: Check for new Release
+    runs-on: [ubuntu-latest]
+    strategy:
+      matrix:
+        branch: ['v5.9.x']
+    steps:
+    - name: Checkout Sources
+      uses: actions/checkout@v2
+      with:
+        ref: ${{ matrix.branch }}
+    - uses: tibdex/github-app-token@v1
+      id: generate-token
+      with:
+        app_id: ${{ secrets.APP_ID }}
+        private_key: ${{ secrets.APP_PRIVATE_KEY }}
+    - name: Setup System Dependencies
+      run: sudo apt install jq curl
+    - name: Check for Release
+      id: check
+      run: |
+        NEW=$(scripts/check.sh ${{ matrix.branch }})
+        if [[ -z $NEW ]]; then
+            echo "No new release found"
+            exit 0
+        fi
+        echo "Found new Linux kernel version $NEW"
+        STAGING=$(git ls-remote --heads origin "staging/v$NEW*")
+        if [[ $STAGING ]]; then
+            echo "Existing staging update found"
+            exit 0
+        fi
+        echo "No staging update found: triggering update"
+        echo "::set-output name=version::$NEW"
+    - name: Trigger Update
+      if: ${{ steps.check.outputs.version }}
+      uses: benc-uk/workflow-dispatch@v1
+      with:
+        workflow: Kernel Update
+        token: ${{ steps.generate-token.outputs.token }} # Custom token needed to recursively trigger workflows
+        inputs: '{ "tag": "cod/mainline/v${{ steps.check.outputs.version }}" }'
+        ref: ${{ matrix.branch }}
+

+ 10 - 0
scripts/check.sh

@@ -0,0 +1,10 @@
+#1/bin/bash
+# Script to check for new kernel release
+set -e
+set -o pipefail
+
+MAJOR=$(echo $1 | sed -e "s/^v//" -e "s/\.[^.]*$//")
+CURRENT=$(scripts/version.sh -L)
+NEW=$(curl -s https://www.kernel.org/releases.json | jq -r ".releases[]|select(.version | startswith(\"$MAJOR\")) | .version")
+
+[[ "$CURRENT" = "$NEW" ]] || echo $NEW