-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (89 loc) · 3.96 KB
/
Copy pathbuild.yml
File metadata and controls
94 lines (89 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: AARCH64
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 0 * * 0-6' # every day
jobs:
check_update:
name: Check update
runs-on: ubuntu-latest
steps:
- name: Check version
id: check_version
run: |
local_version=$(curl -L --header 'authorization: Bearer ${{ github.token }}' https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
remote_version=$(curl -L https://api.github.com/repos/rurioss/rurima-aio/releases/latest | jq -r .tag_name)
echo local_version=$local_version | tee -a $GITHUB_OUTPUT
echo remote_version=$remote_version | tee -a $GITHUB_OUTPUT
outputs:
local_version: ${{ steps.check_version.outputs.local_version }}
remote_version: ${{ steps.check_version.outputs.remote_version }}
build:
name: Build
needs: check_update
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set env
run: |
echo remote_version=${{ needs.check_update.outputs.remote_version }} | tee -a $GITHUB_ENV
echo build_time=$(TZ=Asia/Shanghai date '+%Y%m%d%H%M') | tee -a $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get --no-install-recommends -y install \
binutils build-essential libcap-dev libseccomp-dev make qemu-user-static xz-utils
- name: Build ruri for container
run: |
cd build
git clone --depth 1 https://github.com/moe-hacker/ruri.git
cd ruri
cc -Wl,--gc-sections -static src/*.c src/easteregg/*.c -o ruri -lcap -lseccomp -lpthread
sudo cp ./ruri /usr/bin/ruri
- name: Download alpine rootfs
env:
URL: https://dl-cdn.alpinelinux.org/alpine/edge/releases
ARCHITECTURE: aarch64
run: |
mkdir -p alpine
wget -q https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O yq
sudo mv yq /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
FILE=$(curl -s "$URL/$ARCHITECTURE/latest-releases.yaml" | yq '.[] | select(.flavor == "alpine-minirootfs") | .file')
wget "$URL/$ARCHITECTURE/$FILE"
tar -xzf "$FILE" -C alpine
- name: Build AARCH64
run: |
cat << 'EOF' | sudo tee alpine/build.sh
#!/bin/sh
rm /etc/resolv.conf
echo "nameserver 1.1.1.1" > /etc/resolv.conf
echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
apk update
apk add bash curl wget sudo coreutils clang make git
apk add wget make clang git xz-dev libintl libbsd-static libsemanage-dev libselinux-utils libselinux-static xz-libs zlib zlib-static libselinux-dev linux-headers libssl3 libbsd libbsd-dev gettext-libs gettext-static gettext-dev gettext python3 build-base openssl-misc openssl-libs-static openssl zlib-dev xz-dev openssl-dev automake libtool bison flex gettext autoconf gettext sqlite sqlite-dev pcre-dev wget texinfo docbook-xsl libxslt docbook2x musl-dev gettext gettext-asprintf gettext-dbg gettext-dev gettext-doc gettext-envsubst gettext-lang gettext-libs gettext-static
apk add upx
git clone https://github.com/rurioss/rurima-aio
cd rurima-aio
make
mv out rurima-aio
tar -cvf /$(uname -m).tar rurima-aio
EOF
sudo chmod +x alpine/build.sh
sudo ruri -a aarch64 -q /usr/bin/qemu-aarch64-static ./alpine /bin/sh /build.sh
sudo mv alpine/aarch64.tar ./aarch64.tar
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.remote_version }}
body: |
Build time: ${{ env.build_time }}
prerelease: false
files: |
/home/runner/work/rurima-aio/rurima-aio/aarch64.tar