Include in all sub-jobs steps to clean workflows. #29
This file contains 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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Publish Nightly | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
target: | |
required: true | |
type: string | |
env: | |
DEBIAN_FRONTEND: 'noninteractive' | |
TZ: Etc/UTC | |
jobs: | |
vanilla: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 16384 | |
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 | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 16384 | |
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: 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: Publish release | |
uses: notpeelz/action-gh-create-release@v5.0.1 | |
with: | |
target: ${{ inputs.target }} | |
tag: nightly | |
prerelease: true | |
strategy: replace | |
title: "Automatic build" | |
body: "Automatic build" | |
files: | | |
kernel-debian.deb | |
alpine-apk.tar.lzo | |
kernel.tar.gz | |
kernel-alpine.tar.gz | |