Skip to content

Commit 7cb3004

Browse files
committed
ci: add a workflow for release automation
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
1 parent b434f6b commit 7cb3004

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build_alioth:
10+
strategy:
11+
matrix:
12+
include:
13+
- target: x86_64-unknown-linux-gnu
14+
os: ubuntu-latest
15+
- target: aarch64-unknown-linux-gnu
16+
os: ubuntu-24.04-arm
17+
- target: aarch64-apple-darwin
18+
os: macos-latest
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
- uses: dtolnay/rust-toolchain@stable
23+
- name: Build
24+
run: RUSTFLAGS='-C target-feature=+crt-static' cargo +stable build --target ${{ matrix.target }} --release
25+
- name: Upload artifact
26+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
27+
with:
28+
name: alioth-${{ matrix.target }}
29+
path: target/${{ matrix.target }}/release/alioth
30+
31+
build_bootloader:
32+
uses: ./.github/workflows/bootloader.yml
33+
34+
create_release:
35+
needs: [build_alioth, build_bootloader]
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: write
39+
steps:
40+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
41+
- name: Get tag message
42+
id: tag_message
43+
run: |
44+
echo "msg<<EOF" >> "$GITHUB_OUTPUT"
45+
git show -s --format=%b HEAD | head -n -2 \
46+
>> "$GITHUB_OUTPUT"
47+
echo "EOF" >> "$GITHUB_OUTPUT"
48+
- name: Download all artifacts
49+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
50+
with:
51+
path: artifacts
52+
- name: Create tarballs
53+
run: |
54+
for dir in artifacts/alioth-*; do
55+
IFS='-' read -r -a parts <<< "$dir"
56+
arch=${parts[1]}
57+
os=${parts[3]}
58+
tar -cJf alioth-${os}-${arch}.tar.xz \
59+
-C $PWD/$dir alioth \
60+
-C $PWD/artifacts/kernel-${arch} kernel-${arch}
61+
done
62+
- name: Create Release
63+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
64+
with:
65+
files: alioth-*-*.tar.xz
66+
fail_on_unmatched_files: true
67+
draft: true
68+
body: ${{ steps.tag_message.outputs.msg }}

0 commit comments

Comments
 (0)