Skip to content

Build grub

Build grub #3

Workflow file for this run

#
# Copyright (C) 2022 Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Build grub
on:
workflow_dispatch:
inputs:
push:
description: "push"
default: false
type: boolean
jobs:
grub:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Checkout
uses: actions/checkout@main
with:
repository: RROrg/rc-load
token: ${{ secrets.RRORG }}
path: rc-load
- name: Initialization environment
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
sudo apt update
sudo apt install -y build-essential bison flex dosfstools
- name: Make Grub
run: |
. rc-load/ext/grub.sh "grub-2.06" "i386-pc i386-efi x86_64-efi" "RC"
- name: Upload artifact
if: success() && inputs.push == false
uses: actions/upload-artifact@v3
with:
name: grub
path: |
grub.img.gz
- name: Check and Push
if: success() && inputs.push == true
run: |
if [ -f "grub.img.gz" ]; then
echo "Copy img ..."
cp -f grub.img.gz rc-load/ext/boot-image-template.img.gz
cd rc-load
echo "Git push ..."
git pull
status=$(git status -s | grep -E 'boot-image-template.img.gz' | awk '{printf " %s", $2}')
if [ -n "${status}" ]; then
git add ${status}
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
fi
else
echo "No change ..."
fi