Skip to content

Commit 3764e86

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

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+\\.[0-9]+\\.[0-9]+.*"
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 tag -l --format='%(contents)' ${{ github.ref_name }} >> "$GITHUB_OUTPUT"
46+
echo "EOF" >> "$GITHUB_OUTPUT"
47+
- name: Download all artifacts
48+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
49+
with:
50+
path: artifacts
51+
- name: Create tarballs
52+
run: |
53+
for dir in artifacts/alioth-*; do
54+
IFS='-' read -r -a parts <<< "$dir"
55+
arch=${parts[1]}
56+
os=${parts[3]}
57+
tar -cJf alioth-${os}-${arch}.tar.xz \
58+
-C $PWD/$dir alioth \
59+
-C $PWD/artifacts/kernel-${arch} kernel-${arch}
60+
done
61+
- name: Create Release
62+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
63+
with:
64+
files: alioth-*-*.tar.xz
65+
fail_on_unmatched_files: true
66+
draft: true
67+
body: ${{ steps.tag_message.outputs.msg }}

0 commit comments

Comments
 (0)