flatcar-scripts/.github/workflows/kernel-release.yaml
Dongsu Park b2e55c063a .github: skip touching open PRs when the remote branch exists
To avoid noise of touching existing PRs, check first if the remote
branch already exists. If that exists, skip creating or updating the PR.
2023-05-03 17:37:34 +02:00

70 lines
3.1 KiB
YAML

name: Get the latest Kernel release for all maintained branches
on:
schedule:
- cron: '0 7 * * *'
workflow_dispatch:
jobs:
get-kernel-release:
strategy:
matrix:
channel: [main,alpha,beta,stable,lts,lts-old]
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Check out main scripts branch for GitHub workflow scripts only
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PR_TOKEN }}
path: gha
ref: main
- name: Figure out branch
id: figure-out-branch
run: gha/.github/workflows/figure-out-branch.sh '${{ matrix.channel }}'
- name: Check out work scripts branch for updating
if: steps.figure-out-branch.outputs.SKIP == 0
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PR_TOKEN }}
path: work
ref: ${{ steps.figure-out-branch.outputs.BRANCH }}
- name: Figure out latest Linux release version
if: steps.figure-out-branch.outputs.SKIP == 0
id: kernel-latest-release
env:
GHA_SCRIPTS_DIR: "${{ github.workspace }}/gha"
WORK_SCRIPTS_DIR: "${{ github.workspace }}/work"
run: gha/.github/workflows/kernel-current-major-version.sh
- name: Set up Flatcar SDK
if: steps.figure-out-branch.outputs.SKIP == 0
id: setup-flatcar-sdk
env:
WORK_SCRIPTS_DIR: "${{ github.workspace }}/work"
CHANNEL: ${{ steps.figure-out-branch.outputs.LABEL }}
# This will be empty for the main channel, but we handle
# this case inside setup-flatcar-sdk.sh.
MIRROR_LINK: ${{ steps.figure-out-branch.outputs.LINK }}
run: gha/.github/workflows/setup-flatcar-sdk.sh
- name: Apply patch
if: steps.figure-out-branch.outputs.SKIP == 0
id: apply-patch
env:
GHA_SCRIPTS_DIR: "${{ github.workspace }}/gha"
WORK_SCRIPTS_DIR: "${{ github.workspace }}/work"
VERSION_NEW: ${{ steps.kernel-latest-release.outputs.KERNEL_VERSION }}
PACKAGES_CONTAINER: ${{ steps.setup-flatcar-sdk.outputs.PACKAGES_CONTAINER }}
SDK_NAME: ${{ steps.setup-flatcar-sdk.outputs.SDK_NAME }}
TARGET_BRANCH: ${{ steps.figure-out-branch.outputs.BRANCH }}
run: gha/.github/workflows/kernel-apply-patch.sh
- name: Create pull request
if: (steps.figure-out-branch.outputs.SKIP == 0) && (steps.apply-patch.outputs.UPDATE_NEEDED == 1)
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_PR_TOKEN }}
path: work
branch: "linux-${{ steps.kernel-latest-release.outputs.KERNEL_VERSION }}-${{ steps.figure-out-branch.outputs.BRANCH }}"
base: ${{ steps.figure-out-branch.outputs.BRANCH }}
title: Upgrade Linux Kernel for ${{ steps.figure-out-branch.outputs.BRANCH }} from ${{ steps.apply-patch.outputs.VERSION_OLD }} to ${{ steps.kernel-latest-release.outputs.KERNEL_VERSION }}
body: Subject says it all.
labels: ${{ steps.figure-out-branch.outputs.LABEL }}