diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0e5cdd20 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+\\.[0-9]+\\.[0-9]+.*" + +jobs: + build_alioth: + strategy: + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm + - target: aarch64-apple-darwin + os: macos-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: dtolnay/rust-toolchain@stable + - name: Build + run: RUSTFLAGS='-C target-feature=+crt-static' cargo +stable build --target ${{ matrix.target }} --release + - name: Upload artifact + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: alioth-${{ matrix.target }} + path: target/${{ matrix.target }}/release/alioth + + build_bootloader: + uses: ./.github/workflows/bootloader.yml + + create_release: + needs: [build_alioth, build_bootloader] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - name: Get tag message + id: tag_message + run: | + echo "msg<> "$GITHUB_OUTPUT" + git tag -l --format='%(contents)' ${{ github.ref_name }} >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + - name: Download all artifacts + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + path: artifacts + - name: Create tarballs + run: | + for dir in artifacts/alioth-*; do + IFS='-' read -r -a parts <<< "$dir" + arch=${parts[1]} + os=${parts[3]} + tar -cJf alioth-${os}-${arch}.tar.xz \ + -C $PWD/$dir alioth \ + -C $PWD/artifacts/kernel-${arch} kernel-${arch} + done + - name: Create Release + uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 + with: + files: alioth-*-*.tar.xz + fail_on_unmatched_files: true + draft: true + body: ${{ steps.tag_message.outputs.msg }}