Skip to content

Fix kernelver.

Fix kernelver. #6

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
workflow_call:
inputs:
target:
required: true
type: string
tag:
type: string
description: 'Tag to release (e.g. v1.0.0)'
required: true
default: 'v1.0.0'
prerelease:
description: "Prerelease"
required: false
default: false
type: boolean
env:
DEBIAN_FRONTEND: 'noninteractive'
TZ: Etc/UTC
tag: ${{ github.event.inputs.tag || github.ref_name || 'v1.0' }}
prev_tag: ${{ github.event.inputs.tag || github.ref_name || 'v1.0' }}
jobs:
vanilla:
runs-on: ubuntu-24.04
timeout-minutes: 345600
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 32768
swap-size-mb: 2048
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 6
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose
run: |
for i in {1..3}; do
echo "Attempt $i"
if /bin/sh build.sh run vanilla; then
break
fi
sleep 10
done
continue-on-error: false
- name: Upload kernel
if: success()
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: kernel
path: packages/kernel.tar.gz
vanilla-fallback:
runs-on: self-hosted
timeout-minutes: 345600
needs: [vanilla]
if: failure()
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 6
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose on self-hosted
run: /bin/sh build.sh run vanilla
- name: Upload kernel
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: kernel
path: packages/kernel.tar.gz
vanilla-alpine:
runs-on: ubuntu-24.04
timeout-minutes: 345600
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 32768
swap-size-mb: 2048
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 6
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose
run: |
for i in {1..3}; do
echo "Attempt $i"
if /bin/sh build.sh run vanilla-alpine; then
break
fi
sleep 10
done
continue-on-error: false
- name: Upload kernel
if: success()
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: kernel-alpine
path: packages/kernel-alpine.tar.gz
vanilla-alpine-fallback:
runs-on: self-hosted
timeout-minutes: 345600
needs: [vanilla-alpine]
if: failure()
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 6
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose on self-hosted
run: /bin/sh build.sh run vanilla-alpine
- name: Upload kernel
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: kernel-alpine
path: packages/kernel-alpine.tar.gz
debian:
runs-on: ubuntu-24.04
needs: [vanilla, vanilla-fallback]
if: |
always() &&
(needs.vanilla.result == 'success' && needs.vanilla-fallback.result == 'skipped') ||
(needs.vanilla.result == 'failure' && needs.vanilla-fallback.result == 'success')
steps:
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Create directory
run: |
mkdir packages
- name: Download kernel
uses: actions/download-artifact@v4
with:
name: kernel
path: ./packages
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose
run: |
for i in {1..3}; do
echo "Attempt $i"
if /bin/sh build.sh run debian; then
break
fi
sleep 10
done
continue-on-error: true
- name: Upload debian package
if: success()
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: debian-deb
path: packages/debian/kernel-debian.deb
debian-fallback:
runs-on: self-hosted
needs: [debian]
if: always() &&
(needs.debian.result == 'failure')
steps:
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Create directory
run: mkdir packages
- name: Download kernel
uses: actions/download-artifact@v4
with:
name: kernel
path: ./packages
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose on self-hosted
run: /bin/sh build.sh run debian
- name: Upload debian package
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: debian-deb
path: packages/debian/kernel-debian.deb
alpine:
runs-on: ubuntu-24.04
needs: [vanilla-alpine, vanilla-alpine-fallback]
if: |
always() &&
(needs.vanilla-alpine.result == 'success' && needs.vanilla-alpine-fallback.result == 'skipped') ||
(needs.vanilla-alpine.result == 'failure' && needs.vanilla-alpine-fallback.result == 'success')
steps:
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Create directory
run: |
mkdir packages
- name: Download kernel
uses: actions/download-artifact@v4
with:
name: kernel-alpine
path: ./packages
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose
run: |
for i in {1..3}; do
echo "Attempt $i"
if /bin/sh build.sh run alpine; then
break
fi
sleep 10
done
continue-on-error: true
- name: Package
if: success()
run: |
sudo apt-get update
sudo apt-get install -y tar lzop
cd packages/alpine
sudo tar --lzop -cvf alpine-apk.tar.lzo keys pkg
sudo chown -R $USER:$USER alpine-apk.tar.lzo
- name: Upload alpine package
if: success()
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: alpine-apk
path: packages/alpine/alpine-apk.tar.lzo
alpine-fallback:
runs-on: self-hosted
needs: [alpine]
if: always() &&
(needs.alpine.result == 'failure')
steps:
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Create directory
run: mkdir packages
- name: Download kernel
uses: actions/download-artifact@v4
with:
name: kernel-alpine
path: ./packages
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose on self-hosted
run: /bin/sh build.sh run alpine
- name: Package
run: |
sudo apt-get update
sudo apt-get install -y tar lzop
cd packages/alpine
sudo tar --lzop -cvf alpine-apk.tar.lzo keys pkg
sudo chown -R $USER:$USER alpine-apk.tar.lzo
- name: Upload alpine package
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: alpine-apk
path: packages/alpine/alpine-apk.tar.lzo
publish:
runs-on: ubuntu-24.04
needs: [debian, debian-fallback, alpine, alpine-fallback]
if: |
always() &&
(needs.debian.result == 'success' && needs.debian-fallback.result == 'skipped' && needs.alpine.result == 'success' && needs.alpine-fallback.result == 'skipped') ||
(needs.debian.result == 'failure' && needs.debian-fallback.result == 'success' && needs.alpine.result == 'failure' && needs.alpine-fallback.result == 'success') ||
(needs.debian.result == 'failure' && needs.debian-fallback.result == 'success' && needs.alpine.result == 'success' && needs.alpine-fallback.result == 'skipped') ||
(needs.debian.result == 'success' && needs.debian-fallback.result == 'skipped' && needs.alpine.result == 'failure' && needs.alpine-fallback.result == 'success')
steps:
- name: Install git
run: |
sudo apt-get update
sudo apt-get install -y git git-lfs
sudo apt-get autopurge -y
sudo apt-get clean
- name: Checkout branch
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ inputs.target }}
fetch-depth: '0'
fetch-tags: 'true'
lfs: 'true'
submodules: 'true'
set-safe-directory: 'true'
- name: Download Debian Deb
uses: actions/download-artifact@v4
with:
name: debian-deb
path: .
- name: Download Alpine Apk
uses: actions/download-artifact@v4
with:
name: alpine-apk
path: .
- name: Download Debian kernel
uses: actions/download-artifact@v4
with:
name: kernel
path: .
- name: Download Alpine kernel
uses: actions/download-artifact@v4
with:
name: kernel-alpine
path: .
- name: Set tag from input or trigger
id: set_tag
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "tag=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///')" >> $GITHUB_ENV
fi
- name: Get previous tag
id: prev_tag
run: |
# Find the previous tag, excluding the current tag
prev_tag=$(git describe --abbrev=0 --tags --exclude="${{ env.tag }}")
echo "prev_tag=${prev_tag}" >> $GITHUB_ENV
- name: Publish release
uses: notpeelz/[email protected]
with:
target: ${{ inputs.target }}
tag: ${{ env.tag }}
prerelease: ${{ inputs.prerelease }}
draft: false
strategy: replace
title: Release ${{ env.tag }}
body: |
## Changelog
Changes since the last release: [${{ env.prev_tag }}...${{ env.tag }}](https://github.com/${{ github.repository }}/compare/${{ env.prev_tag }}...${{ env.tag }})
---
Build made in GitHub Actions.
files: |
kernel-debian.deb
alpine-apk.tar.lzo
kernel.tar.gz
kernel-alpine.tar.gz