Skip to content

Build and Release ISO #96

Build and Release ISO

Build and Release ISO #96

Workflow file for this run

name: Build and Release ISO
on:
push:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch:
inputs:
enable_nvidia:
description: 'Include NVIDIA packages (1 to enable, 0 to disable)'
required: false
default: '0'
enable_amd:
description: 'Include AMD packages (1 to enable, 0 to disable)'
required: false
default: '0'
jobs:
get-k8s-version:
runs-on: ubuntu-latest
outputs:
K8S_VERSION: ${{ steps.get-version.outputs.version }}
TAG_NAME: ${{ steps.set-tag-name.outputs.tag_name }}
steps:
- name: Get Latest Kubernetes Version
id: get-version
run: |
version=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt | tr -d 'v')
echo "::set-output name=version::$version"
- name: Determine Tag Name
id: set-tag-name
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
tag_name="nightly-$(date +%Y%m%d)"
elif [ "${{ github.event_name }}" == "push" ]; then
tag_name="v${{ steps.get-version.outputs.version }}-${{ github.sha }}"
else
tag_name="v${{ steps.get-version.outputs.version }}"
fi
echo "::set-output name=tag_name::$tag_name"
- name: Set Unique Build ID
id: set-build-id
run: |
BUILD_ID=$(uuidgen)
echo "build_id=$BUILD_ID" >> $GITHUB_OUTPUT
build-and-push-docker-image:
runs-on: ubuntu-latest
needs: get-k8s-version
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for full git history
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: |
docker build -t ghcr.io/mcserverhosting-net/os:latest .
docker push ghcr.io/mcserverhosting-net/os:latest
build-iso-x86-64-v2:
runs-on: ubuntu-latest
needs: [get-k8s-version, build-and-push-docker-image]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build ISO for x86-64-v2
env:
K8S_VERSION: ${{ needs.get-k8s-version.outputs.K8S_VERSION }}
FEATURE_LEVELS: x86-64-v2
ENABLE_NVIDIA: ${{ github.event.inputs.enable_nvidia || '0' }}
ENABLE_AMD: ${{ github.event.inputs.enable_amd || '0' }}
BUILD_ID: ${{ needs.get-k8s-version.outputs.BUILD_ID }}
run: |
docker run --privileged \
-e K8S_VERSION=$K8S_VERSION \
-e FEATURE_LEVELS=$FEATURE_LEVELS \
-e ENABLE_NVIDIA=$ENABLE_NVIDIA \
-e ENABLE_AMD=$ENABLE_AMD \
-v ${{ github.workspace }}:/workspace \
--entrypoint /bin/bash \
ghcr.io/mcserverhosting-net/os:latest \
-c "cd /workspace && make clean && make K8S_VERSION=$K8S_VERSION FEATURE_LEVELS=$FEATURE_LEVELS ENABLE_NVIDIA=$ENABLE_NVIDIA ENABLE_AMD=$ENABLE_AMD BUILD_ID=$BUILD_ID"
- name: List generated ISOs
run: ls -lh baseline/out/*.iso
- name: Upload ISO Artifact
uses: actions/upload-artifact@v3
with:
name: custom-archiso-${{ env.FEATURE_LEVELS }}
path: baseline/out/*.iso
build-iso-x86-64-v3:
runs-on: ubuntu-latest
needs: [get-k8s-version, build-and-push-docker-image]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build ISO for x86-64-v3
env:
K8S_VERSION: ${{ needs.get-k8s-version.outputs.K8S_VERSION }}
FEATURE_LEVELS: x86-64-v3
ENABLE_NVIDIA: ${{ github.event.inputs.enable_nvidia || '0' }}
ENABLE_AMD: ${{ github.event.inputs.enable_amd || '0' }}
BUILD_ID: ${{ needs.get-k8s-version.outputs.BUILD_ID }}
run: |
docker run --privileged \
-e K8S_VERSION=$K8S_VERSION \
-e FEATURE_LEVELS=$FEATURE_LEVELS \
-e ENABLE_NVIDIA=$ENABLE_NVIDIA \
-e ENABLE_AMD=$ENABLE_AMD \
-v ${{ github.workspace }}:/workspace \
--entrypoint /bin/bash \
ghcr.io/mcserverhosting-net/os:latest \
-c "cd /workspace && make clean && make K8S_VERSION=$K8S_VERSION FEATURE_LEVELS=$FEATURE_LEVELS ENABLE_NVIDIA=$ENABLE_NVIDIA ENABLE_AMD=$ENABLE_AMD BUILD_ID=$BUILD_ID"
- name: List generated ISOs
run: ls -lh baseline/out/*.iso
- name: Upload ISO Artifact
uses: actions/upload-artifact@v3
with:
name: custom-archiso-${{ env.FEATURE_LEVELS }}
path: baseline/out/*.iso
create-release:
runs-on: ubuntu-latest
needs: [build-iso-x86-64-v2, build-iso-x86-64-v3]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*.iso
prerelease: ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}