Skip to content

.github/workflows/ci.yml #10

.github/workflows/ci.yml

.github/workflows/ci.yml #10

Workflow file for this run

on:
push:
permissions:
contents: write
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: Build UEFI application
id: system-paths
run: |
export INCLUDE_DIRS="$(dirname $(find /usr/include -name efi.h | head -n 1))"
export LD_OBJ="$(find /usr/lib -name crt0-efi-x86_64.o | head -n 1)"
export EFI_LDS="$(find /usr/lib -name elf_x86_64_efi.lds | head -n 1)"
export BIOS_FD="$(find /usr/share -name OVMF.fd | head -n 1)"
export LD_EXTRA="-L$(dirname $(find /usr/lib -name libgnuefi.a | head -n 1))"
make main.efi reboot.img
- 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: Set up Git
run: |
git config --global safe.directory /github/workspace
git fetch --tags
- name: Get release tag
id: get_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Get release notes from CHANGELOG.md
id: get_release_notes
run: |
release_notes=$(cat CHANGELOG.md)
echo "release_notes<<EOF" >> $GITHUB_ENV
echo "${release_notes}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=${{ env.tag }}
release_notes=${{ env.release_notes }}
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tag_name": "'"$tag"'","name": "Release '"$tag"'","body": "'"$release_notes"'","draft": false,"prerelease": false}' \
https://api.github.com/repos/${{ github.repository }}/releases
- name: Get upload URL
id: get_upload_url
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
upload_url=$(curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ env.tag }} | jq -r .upload_url | sed 's/{?name,label}//')
echo "upload_url=${upload_url}" >> $GITHUB_ENV
- name: Upload main.efi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @./path/to/main.efi \
"${{ env.upload_url }}?name=main.efi"
- name: Upload reboot.img
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @./path/to/reboot.img \
"${{ env.upload_url }}?name=reboot.img"