rulimine/.github/workflows/release.yml
2021-10-24 15:48:52 +02:00

113 lines
3.5 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and upload artifacts
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: '0'
- 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]\+\.')0-branch" >> $GITHUB_ENV
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install git build-essential nasm gcc-mingw-w64 gcc-multilib curl mtools -y
- name: Build the toolchain
run: make toolchain
- name: Build the bootloader
run: make
- name: Clean limine-install
run: make -C limine-install clean
- name: Build limine-install-linux-x86_64
run: make CFLAGS="-O2 -pipe -static" bin/limine-install
- name: Strip limine-install-linux-x86_64
run: strip bin/limine-install
- name: Rename limine-install-linux-x86_64
run: mv bin/limine-install bin/limine-install-linux-x86_64
- name: Clean limine-install
run: make -C limine-install clean
- name: Build limine-install-linux-x86_32
run: make CC="gcc -m32" CFLAGS="-O2 -pipe -static" bin/limine-install
- name: Strip limine-install-linux-x86_32
run: strip bin/limine-install
- name: Rename limine-install-linux-x86_32
run: mv bin/limine-install bin/limine-install-linux-x86_32
- name: Clean limine-install
run: make -C limine-install clean
- name: Build limine-install-win32
run: make CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" bin/limine-install
- name: Strip limine-install-win32
run: i686-w64-mingw32-strip bin/limine-install.exe
- name: Rename limine-install-win32
run: mv bin/limine-install.exe bin/limine-install-win32.exe
- name: Clean limine-install
run: make -C limine-install clean
- name: Copy limine-install to bin
run: cp limine-install/* limine-install/.gitignore bin/
- name: Copy LICENSE to bin
run: cp LICENSE.md bin/
- name: Push binaries to binary branch
run: |
git config user.name 'mintsuki'
git config user.email 'mintsuki@users.noreply.github.com'
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 '^bin$')
cp -r bin/. ./
rm -rf bin
git add .
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
git checkout latest-binary
git rebase $BRANCH_NAME-binary && git push origin latest-binary
- name: Cleanup source tree
run: git checkout $TAG_NAME && rm -rf * && git checkout .
- name: Package release tarball
run: make dist
- name: Create release notes
run: echo "Binary release can be found at 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.xz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}