limine/.github/workflows/release.yml
2023-12-27 11:02:21 +01:00

108 lines
3.5 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and upload artifacts
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- name: Switch to Arch testing
run: |
set -e
sed -i ':a;N;$!ba;s/#\[core-testing\]\n#Include/[core-testing]\nInclude/g' /etc/pacman.conf
sed -i ':a;N;$!ba;s/#\[extra-testing\]\n#Include/[extra-testing]\nInclude/g' /etc/pacman.conf
- name: Install dependencies
run: pacman --noconfirm -Syu && pacman --needed --noconfirm -S base-devel git autoconf automake nasm curl mtools llvm clang lld mingw-w64-gcc
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Get tag name
run: echo "TAG_NAME=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))" >> $GITHUB_ENV
- name: Get branch name
run: echo "BRANCH_NAME=$(echo "$TAG_NAME" | grep -o 'v[0-9]\+\.')x-branch" >> $GITHUB_ENV
- name: Regenerate
run: ./bootstrap
- name: Create build dir
run: mkdir -p build
- name: Configure
run: cd build && ../configure --enable-all TOOLCHAIN_FOR_TARGET=llvm
- name: Build the bootloader
run: make -C build
- name: Clean limine
run: rm build/bin/limine
- name: Build limine for Windows
run: make -C build/bin CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" CPPFLAGS="-D__USE_MINGW_ANSI_STDIO" limine
- name: Strip limine for Windows
run: i686-w64-mingw32-strip build/bin/limine.exe
- name: Copy LICENSE to bin
run: cp COPYING build/bin/LICENSE
- name: Copy install-sh to bin
run: cp build-aux/install-sh build/bin/
- name: Copy limine.h to bin
run: cp limine.h build/bin/
- name: Remove limine-bios-hdd.bin
run: rm build/bin/limine-bios-hdd.bin
- name: Push binaries to binary branch
run: |
git config user.name 'mintsuki'
git config user.email 'mintsuki@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/limine-bootloader/limine.git
git fetch --all
git checkout $BRANCH_NAME-binary || git checkout --orphan $BRANCH_NAME-binary
rm -rf $(ls -a | grep -v '^\.git$' | grep -v '^\.\.$' | grep -v '^\.$' | grep -v '^build$')
cp -r build/bin/. ./
rm -rf build
git add -f .
git commit -m "Binary release $TAG_NAME"
git push origin $BRANCH_NAME-binary
git tag $TAG_NAME-binary
git push origin $BRANCH_NAME-binary --tags
- name: Cleanup source tree
run: git checkout $TAG_NAME && rm -rf * && git checkout .
- name: Package release tarball
run: ./bootstrap && ./configure --enable-all && make dist
- name: Create release notes
run: |
echo "Changelog can be found [here](https://github.com/limine-bootloader/limine/releases/download/$TAG_NAME/ChangeLog)." > rel_notes.txt
echo "" >> rel_notes.txt
echo "Binary release can be found [here](https://github.com/limine-bootloader/limine/tree/$TAG_NAME-binary)." >> rel_notes.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: rel_notes.txt
files: |
limine-*.tar.*
ChangeLog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}