kernel check #387
This file contains hidden or 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: kernel-check | |
| run-name: kernel check | |
| on: | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pages: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_build: ${{ steps.version.outputs.should_build }} | |
| kernel_version: ${{ steps.version.outputs.kernel_version }} | |
| steps: | |
| - name: Check for new kernel version | |
| id: version | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| KBRANCH="6.18" | |
| LATEST=$(curl -s https://www.kernel.org/releases.json | \ | |
| jq -r --arg branch "${KBRANCH}." \ | |
| '[.releases[] | select(.version | startswith($branch))] | first | .version') | |
| LAST_TAG=$(gh release list \ | |
| --repo ${{ github.repository }} \ | |
| --limit 1 \ | |
| --json tagName \ | |
| -q '.[0].tagName // ""' 2>/dev/null || echo "") | |
| LAST_BUILT="${LAST_TAG#v}" | |
| echo "Latest upstream: ${LATEST}" | |
| echo "Last built: ${LAST_BUILT}" | |
| echo "kernel_version=${LATEST}" >> $GITHUB_OUTPUT | |
| if [ "${LATEST}" != "${LAST_BUILT}" ]; then | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "should_build=false" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| needs: check | |
| if: needs.check.outputs.should_build == 'true' | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| kernel_version: ${{ needs.check.outputs.kernel_version }} | |
| secrets: inherit | |
| dispatch: | |
| needs: check | |
| if: needs.check.outputs.should_build == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if image exists in openframe-linux | |
| id: image | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| TAG="v${{ needs.check.outputs.kernel_version }}" | |
| if gh release view "${TAG}" --repo birdslikewires/openframe-linux > /dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Image already exists for ${TAG}, skipping dispatch." | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "No image found for ${TAG}, dispatching to openframe-linux." | |
| fi | |
| - name: Dispatch image build | |
| if: steps.image.outputs.exists == 'false' | |
| env: | |
| GH_TOKEN: ${{ secrets.DISPATCH_TOKEN }} | |
| run: | | |
| gh api repos/birdslikewires/openframe-linux/dispatches \ | |
| --method POST \ | |
| --field event_type=kernel-released \ | |
| --field client_payload[kernel_version]="${{ needs.check.outputs.kernel_version }}" |