Skip to content

stuff n things

stuff n things #26

Workflow file for this run

name: Build and Release ISO
on:
push:
schedule:
- cron: '0 0 1 * *' # Runs monthly on the 1st 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:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for full git history to compare changes
- name: Determine Changed Files
id: changes
uses: dorny/paths-filter@v2
with:
filters: |
docker:
- 'Dockerfile'
- 'docker/**'
- name: Output Changed Files
run: |
echo "Docker files changed: ${{ steps.changes.outputs.docker_changed }}"
echo "ISO files changed: ${{ steps.changes.outputs.iso_changed }}"
echo "Any files changed: ${{ steps.changes.outputs.any_changed }}"
- name: Log in to GHCR
if: steps.changes.outputs.any_changed == 'true' || github.event_name == 'schedule'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Latest Kubernetes Version
id: get_k8s_version
run: |
echo "version=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt | tr -d 'v')" >> $GITHUB_OUTPUT
- name: Set Environment Variables
run: |
echo "K8S_VERSION=${{ steps.get_k8s_version.outputs.version }}" >> $GITHUB_ENV
echo "ENABLE_NVIDIA=${{ github.event.inputs.enable_nvidia || '0' }}" >> $GITHUB_ENV
echo "ENABLE_AMD=${{ github.event.inputs.enable_amd || '0' }}" >> $GITHUB_ENV
- name: Build and Push Docker Image
if: steps.changes.outputs.docker_changed == 'true' || github.event_name == 'schedule'
run: |
docker build -t ghcr.io/mcserverhosting-net/os:latest .
docker push ghcr.io/mcserverhosting-net/os:latest
- name: Build ISOs
env:
K8S_VERSION: ${{ env.K8S_VERSION }}
ENABLE_NVIDIA: ${{ env.ENABLE_NVIDIA }}
ENABLE_AMD: ${{ env.ENABLE_AMD }}
run: |
docker run --privileged \
-e K8S_VERSION=$K8S_VERSION \
-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 ENABLE_NVIDIA=$ENABLE_NVIDIA ENABLE_AMD=$ENABLE_AMD"
- name: List generated ISOs
if: steps.changes.outputs.iso_changed == 'true' || github.event_name == 'schedule'
run: ls -lh baseline/out/
- name: Upload ISO Artifacts
if: steps.changes.outputs.iso_changed == 'true' || github.event_name == 'schedule'
uses: actions/upload-artifact@v3
with:
name: custom-archiso
path: baseline/out/*.iso
- name: Create GitHub Release
if: steps.changes.outputs.iso_changed == 'true' || github.event_name == 'schedule'
uses: softprops/action-gh-release@v1
with:
tag_name: 'v${{ env.K8S_VERSION }}'
files: baseline/out/*.iso
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}