Combine ci #1
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 UEFI Application | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential gcc gnu-efi mtools parted ovmf qemu-system-x86 | |
- name: Determine system paths | |
id: system-paths | |
run: | | |
echo "INCLUDE_DIRS=$(dirname $(find /usr/include -name efi.h | head -n 1))" >> $GITHUB_OUTPUT | |
echo "LD_OBJ=$(find /usr/lib -name crt0-efi-x86_64.o | head -n 1)" >> $GITHUB_OUTPUT | |
echo "EFI_LDS=$(find /usr/lib -name elf_x86_64_efi.lds | head -n 1)" >> $GITHUB_OUTPUT | |
echo "BIOS_FD=$(find /usr/share -name OVMF.fd | head -n 1)" >> $GITHUB_OUTPUT | |
echo "LD_EXTRA=-L$(find /usr/lib -name libgnuefi.a -exec dirname {} \; | head -n 1)" >>$GITHUB_OUTPUT | |
- name: Build UEFI application | |
run: | | |
make main.efi reboot.img \ | |
INCLUDE_DIRS="${{ steps.system-paths.outputs.INCLUDE_DIRS }}" \ | |
LD_OBJ="${{ steps.system-paths.outputs.LD_OBJ }}" \ | |
EFI_LDS="${{ steps.system-paths.outputs.EFI_LDS }}" \ | |
BIOS_FD="${{ steps.system-paths.outputs.BIOS_FD }}" \ | |
LD_EXTRA="${{ steps.system-paths.outputs.LD_EXTRA }}" | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: reboot-artifacts | |
path: | | |
main.efi | |
reboot.img | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: reboot-artifacts | |
path: ./artifacts | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
This release includes the compiled UEFI application and the disk image. | |
draft: false | |
prerelease: false | |
- name: Upload main.efi to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/main.efi | |
asset_name: main.efi | |
asset_content_type: application/octet-stream | |
- name: Upload reboot.img to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/reboot.img | |
asset_name: reboot.img | |
asset_content_type: application/octet-stream |