limine/.github/workflows/release.yml
2022-06-15 00:35:16 +02:00

104 lines
3.1 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 autoconf automake nasm gcc-mingw-w64 curl mtools -y
- name: Build the toolchain
run: ./make_toolchain.sh
- name: Regenerate
run: ./bootstrap
- name: Create build dir
run: mkdir -p build
- name: Configure
run: cd build && ../configure
- name: Build the bootloader
run: make -C build
- name: Clean limine-deploy
run: rm build/bin/limine-deploy
- name: Build limine-deploy-win32
run: make -C build CC="i686-w64-mingw32-gcc" CFLAGS="-O2 -pipe" limine-deploy
- name: Strip limine-deploy-win32
run: i686-w64-mingw32-strip build/bin/limine-deploy.exe
- name: Copy LICENSE to bin
run: cp LICENSE.md build/bin/
- 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-hdd.bin
run: rm build/bin/limine-hdd.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 '^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 && 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.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Retrieve SSH key
run: 'echo "$ssh_key" > ssh_key && chmod 600 ssh_key'
env:
ssh_key: ${{ secrets.SSH_KEY }}
- name: Upload tarballs to website
run: 'scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ssh_key limine-*.tar.* mint@limine-bootloader.org:/var/www/limine/html/files/limine/'