makefile and workflow stuff #9
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
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: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to GHCR | |
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 | |
run: | | |
docker build -t ghcr.io/mcserverhosting-net/os:latest . | |
docker push ghcr.io/mcserverhosting-net/os:latest | |
- name: Build ISOs | |
env: | |
K8S_VERSION: 1.31.0 | |
ENABLE_NVIDIA: 0 | |
ENABLE_AMD: 0 | |
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 | |
run: ls -lh baseline/out/ | |
- name: Upload ISO Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: custom-archiso | |
path: baseline/out/*.iso | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: 'v${{ env.K8S_VERSION }}' | |
files: baseline/out/*.iso | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |