| 1 | name: Release |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - 'v*' |
| 7 | workflow_dispatch: |
| 8 | inputs: |
| 9 | tag: |
| 10 | description: 'Tag to build (e.g. v12.0.0)' |
| 11 | required: true |
| 12 | type: string |
| 13 | |
| 14 | jobs: |
| 15 | build: |
| 16 | name: Build and upload release artifacts |
| 17 | runs-on: ubuntu-latest |
| 18 | container: archlinux:latest |
| 19 | |
| 20 | steps: |
| 21 | - name: Install dependencies |
| 22 | run: pacman --noconfirm -Syu && pacman --needed --noconfirm -S base-devel gnupg gzip bzip2 xz zip git autoconf automake nasm curl mtools llvm clang lld |
| 23 | |
| 24 | - name: Import GPG public key |
| 25 | run: gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 05D29860D0A0668AAEFB9D691F3C021BECA23821 |
| 26 | |
| 27 | - name: Import GPG private key |
| 28 | run: echo "$MINTSUKI_PRIVATE_KEY" | gpg --batch --import |
| 29 | env: |
| 30 | MINTSUKI_PRIVATE_KEY: ${{ secrets.MINTSUKI_PRIVATE_KEY }} |
| 31 | |
| 32 | - name: Checkout code |
| 33 | uses: actions/checkout@v6 |
| 34 | with: |
| 35 | ref: ${{ inputs.tag || github.ref }} |
| 36 | |
| 37 | - name: Git config |
| 38 | run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 39 | |
| 40 | - name: Get tag name |
| 41 | run: | |
| 42 | if [ -n "${{ inputs.tag }}" ]; then |
| 43 | echo "TAG_NAME=${{ inputs.tag }}" >> $GITHUB_ENV |
| 44 | else |
| 45 | echo "TAG_NAME=$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))" >> $GITHUB_ENV |
| 46 | fi |
| 47 | |
| 48 | - name: Regenerate |
| 49 | run: ./bootstrap |
| 50 | |
| 51 | - name: Create build dir |
| 52 | run: mkdir -p build |
| 53 | |
| 54 | - name: Configure |
| 55 | run: cd build && ../configure --enable-all |
| 56 | |
| 57 | - name: Package source release tarball |
| 58 | run: | |
| 59 | make -C build dist |
| 60 | mv build/limine-*.tar.* ./ |
| 61 | |
| 62 | - name: Build the bootloader |
| 63 | run: make -C build -j$(nproc) |
| 64 | |
| 65 | - name: Clean limine |
| 66 | run: rm build/bin/limine |
| 67 | |
| 68 | - name: Fetch MinGW |
| 69 | run: | |
| 70 | curl -Lo /tmp/mingw-i486.tar.xz https://github.com/osdev0/mingw-binary-builds/releases/latest/download/mingw-i486.tar.xz |
| 71 | cd /tmp |
| 72 | tar -xf mingw-i486.tar.xz |
| 73 | |
| 74 | - name: Build limine for Windows |
| 75 | run: | |
| 76 | make -C build/bin CC="/tmp/mingw-i486/bin/i486-w64-mingw32-gcc" CFLAGS="-O2 -pipe" CPPFLAGS="-D__USE_MINGW_ANSI_STDIO" limine |
| 77 | /tmp/mingw-i486/bin/i486-w64-mingw32-strip build/bin/limine.exe |
| 78 | mkdir build/bin/limine-tool-windows-x86 |
| 79 | mv build/bin/limine.exe build/bin/limine-tool-windows-x86/ |
| 80 | |
| 81 | - name: Copy LICENSE to bin |
| 82 | run: cp COPYING build/bin/LICENSE |
| 83 | |
| 84 | - name: Remove limine-bios-hdd.bin |
| 85 | run: rm build/bin/limine-bios-hdd.bin |
| 86 | |
| 87 | - name: Create binary release zip and tarballs |
| 88 | run: | |
| 89 | mv build/bin ./limine-binary |
| 90 | zip -r limine-binary.zip limine-binary |
| 91 | tar -cvf limine-binary.tar limine-binary |
| 92 | gzip < limine-binary.tar > limine-binary.tar.gz |
| 93 | xz < limine-binary.tar > limine-binary.tar.xz |
| 94 | rm -rf limine-binary.tar limine-binary |
| 95 | |
| 96 | - name: Sign release tarballs |
| 97 | run: | |
| 98 | for f in limine-*.tar.* limine-binary.zip; do |
| 99 | gpg --batch --default-key 05D29860D0A0668AAEFB9D691F3C021BECA23821 --detach-sign "$f" |
| 100 | done |
| 101 | |
| 102 | - name: Create release notes |
| 103 | run: | |
| 104 | cat <<EOF >rel_notes.txt |
| 105 | Changelog can be found [here](https://github.com/Limine-Bootloader/Limine/blob/$TAG_NAME/ChangeLog). |
| 106 | EOF |
| 107 | cat <<'EOF' >>rel_notes.txt |
| 108 | |
| 109 | Tarballs are signed using key ID `05D29860D0A0668AAEFB9D691F3C021BECA23821` which can be obtained from a keyserver such as `keyserver.ubuntu.com`. |
| 110 | |
| 111 | Import the public key with: |
| 112 | ```bash |
| 113 | gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 05D29860D0A0668AAEFB9D691F3C021BECA23821 |
| 114 | ``` |
| 115 | |
| 116 | In order to verify the tarball with the given signature, do: |
| 117 | ```bash |
| 118 | gpg --verify <tarball sig file> <associated tarball> |
| 119 | ``` |
| 120 | EOF |
| 121 | |
| 122 | - name: Release |
| 123 | uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda |
| 124 | with: |
| 125 | tag_name: ${{ env.TAG_NAME }} |
| 126 | body_path: rel_notes.txt |
| 127 | files: | |
| 128 | limine-*.tar.* |
| 129 | limine-binary.zip* |
| 130 | env: |
| 131 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |