Skip to content

Commit 2823bee

Browse files
committed
test
1 parent da3047e commit 2823bee

File tree

2 files changed

+222
-0
lines changed

2 files changed

+222
-0
lines changed
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: 🐬 Create RunImage Images (x86_64) 🐬
2+
concurrency:
3+
group: "${{ github.workflow }}-${{ github.ref }}"
4+
cancel-in-progress: true
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: "0 0 */3 * *" #every 3 Days @5:45 AM NPT
10+
jobs:
11+
push-x86_64:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 200
14+
permissions:
15+
attestations: write
16+
contents: write
17+
id-token: write
18+
packages: write
19+
statuses: read
20+
strategy:
21+
matrix:
22+
include:
23+
- image: "alpine"
24+
script: "${GITHUB_WORKSPACE}/main/alpine.sh"
25+
arch: "x86_64"
26+
file: "/tmp/alpine-x86_64"
27+
28+
- image: "archlinux"
29+
script: "${GITHUB_WORKSPACE}/main/archlinux.sh"
30+
arch: "x86_64"
31+
file: "/tmp/archlinux-x86_64"
32+
33+
- image: "artix"
34+
script: "${GITHUB_WORKSPACE}/main/artix.sh"
35+
arch: "x86_64"
36+
file: "/tmp/artix-x86_64"
37+
38+
- image: "cachyos"
39+
script: "${GITHUB_WORKSPACE}/main/cachyos.sh"
40+
arch: "x86_64"
41+
file: "/tmp/cachyos-x86_64"
42+
43+
- image: "debian"
44+
script: "${GITHUB_WORKSPACE}/main/debian.sh"
45+
arch: "x86_64"
46+
file: "/tmp/debian-x86_64"
47+
48+
- image: "eweos"
49+
script: "${GITHUB_WORKSPACE}/main/eweos.sh"
50+
arch: "x86_64"
51+
file: "/tmp/eweos-x86_64"
52+
53+
- image: "ubuntu"
54+
script: "${GITHUB_WORKSPACE}/main/ubuntu.sh"
55+
arch: "x86_64"
56+
file: "/tmp/ubuntu-x86_64"
57+
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
with:
62+
path: main
63+
filter: "blob:none"
64+
65+
- name: Setup Env
66+
run: |
67+
#presets
68+
set +x ; set +e
69+
#-------------#
70+
#tmp
71+
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
72+
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
73+
#-------------#
74+
##User-Agent
75+
USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}"
76+
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}"
77+
continue-on-error: true
78+
79+
- name: Create (${{ matrix.image }}/${{ matrix.arch }})
80+
run: |
81+
#presets
82+
set +x ; set +e
83+
#-------------#
84+
dos2unix --quiet "${{ matrix.script }}"
85+
chmod +x "${{ matrix.script }}"
86+
bash "${{ matrix.script }}"
87+
continue-on-error: true
88+
89+
- name: Check
90+
run: |
91+
#presets
92+
set +x ; set +e
93+
#-------------#
94+
if [[ -s "${{ matrix.file }}" ]] && [[ $(stat -c%s "${{ matrix.file }}") -gt 10000 ]]; then
95+
export HAS_RUNIMAGE="TRUE"
96+
echo "HAS_RUNIMAGE=${HAS_RUNIMAGE}" >> "${GITHUB_ENV}"
97+
UTC_TIME="$(TZ='UTC' date +'%Y_%m_%d')"
98+
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
99+
else
100+
export HAS_RUNIMAGE="FALSE"
101+
echo "HAS_RUNIMAGE=${HAS_RUNIMAGE}" >> "${GITHUB_ENV}"
102+
fi
103+
continue-on-error: true
104+
105+
- name: Fail (If Push Failed)
106+
if: env.HAS_RUNIMAGE == 'FALSE'
107+
run: |
108+
#presets
109+
set +x ; set +e
110+
#-------------#
111+
exit 1
112+
continue-on-error: false
113+
114+
#Artifacts
115+
- name: Upload (Build) Artifacts
116+
if: env.HAS_RUNIMAGE == 'TRUE'
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: "ARTIFACTS-${{ matrix.image }}_${{ matrix.arch }}"
120+
path: |
121+
${{ matrix.file }}
122+
compression-level: 0 #no compression, [Default: 6 (GNU Gzip)]
123+
retention-days: 90 #max
124+
overwrite: true
125+
continue-on-error: true
126+
127+
#continuous
128+
- name: Releaser (Continuous)
129+
if: env.HAS_RUNIMAGE == 'TRUE'
130+
uses: softprops/[email protected]
131+
with:
132+
name: "Continuous ${{ matrix.image }}_${{ matrix.arch }}"
133+
tag_name: "${{ matrix.image }}_${{ matrix.arch }}"
134+
prerelease: true
135+
draft: false
136+
generate_release_notes: false
137+
files: |
138+
${{ matrix.file }}
139+
continue-on-error: true
140+
141+
#Snapshot
142+
- name: Releaser (Snapshot)
143+
if: env.HAS_RUNIMAGE == 'TRUE'
144+
uses: softprops/[email protected]
145+
with:
146+
name: "Snapshot-(${{ matrix.image }}_${{ matrix.arch }}_${{ env.UTC_TIME }}"
147+
tag_name: "${{ matrix.image }}_${{ matrix.arch }}_${{ env.UTC_TIME }}"
148+
prerelease: false
149+
draft: false
150+
generate_release_notes: false
151+
make_latest: false
152+
files: |
153+
${{ matrix.file }}
154+
continue-on-error: true
155+
156+
#Build Provenance
157+
- name: Attest Build Provenance
158+
if: env.HAS_RUNIMAGE == 'TRUE'
159+
uses: actions/[email protected]
160+
with:
161+
subject-name: "image-${{ matrix.image }}-${{ matrix.arch }}"
162+
subject-path: ${{ matrix.file }}
163+
show-summary: true
164+
continue-on-error: true

alpine.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
#
3+
##DO NOT RUN DIRECTLY
4+
##Self: bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge-dev/runimage-base/refs/heads/main/alpine.sh")
5+
# HOST: aarch64-Linux, x86_64-Linux
6+
#-------------------------------------------------------#
7+
8+
#-------------------------------------------------------#
9+
##Debug
10+
set -x
11+
pushd "$(mktemp -d)" >/dev/null 2>&1
12+
##RunImage
13+
curl -qfsSL "https://github.com/VHSgunzo/runimage/releases/download/continuous/runimage-$(uname -m)" -o "./runimage"
14+
chmod -v 'a+x' "./runimage"
15+
[[ -s "./runimage" ]] || exit 1
16+
##Get Rootfs
17+
"./runimage" getdimg --extract rootfs "pkgforge/alpine-base:$(uname -m)"
18+
RIM_NO_NET="0"
19+
RIM_NO_NVIDIA_CHECK="1"
20+
RIM_OVERFS_MODE="1"
21+
RIM_ROOT="1"
22+
RIM_ROOTFS="$(find '.' -maxdepth 1 -type d -iname "*root*" -exec sh -c '[ -d "{}" ] && realpath "{}"' \; | head -n 1 | tr -d '[:space:]')"
23+
export RIM_NO_NET RIM_NO_NVIDIA_CHECK RIM_OVERFS_MODE RIM_ROOTFS RIM_ROOT
24+
if [ ! -d "${RIM_ROOTFS}" ] || [ ! "$(find "${RIM_ROOTFS}" -mindepth 1 -print -quit 2>/dev/null)" ]; then
25+
echo -e "\n[-] FATAL: Failed to Fetch RootFS"
26+
exit 1
27+
fi
28+
##Base Deps
29+
build_image()
30+
{
31+
#Fix & Patches
32+
echo -e "nameserver 8.8.8.8\nnameserver 2620:0:ccc::2" | tee "/etc/resolv.conf"
33+
echo -e "nameserver 1.1.1.1\nnameserver 2606:4700:4700::1111" | tee -a "/etc/resolv.conf"
34+
#Requirements
35+
BASE_PKGS=(bash binutils coreutils curl file findutils gawk gocryptfs grep gzip iproute2 iptables iputils jq kmod libnotify lsof lz4 nftables openresolv patchelf procps-ng slirp4netns sed socat tar util-linux which xhost xz zstd)
36+
apk update --no-interactive
37+
apk upgrade --no-interactive
38+
apk add "${BASE_PKGS[@]}" --latest --upgrade --no-interactive
39+
#Cleanup
40+
chmod 755 "/bin/bbsuid"
41+
rm -rfv "/var/cache/apk/"* 2>/dev/null
42+
rm -rfv "/usr/share/fonts/"* 2>/dev/null
43+
rm -rfv "/usr/share/licenses/"* 2>/dev/null
44+
rm -rfv "/usr/share/locale/"* 2>/dev/null
45+
rm -rfv "/usr/share/man/"* 2>/dev/null
46+
apk cache clean
47+
ln -s "/dev/null" "/etc/apk/cache"
48+
rim-shrink --all 2>/dev/null
49+
#Rebuild [Dwarfs ZSTD 22]
50+
rim-build --bsize '24' --clvl '22' --dwfs "/tmp/alpine-$(uname -m)"
51+
}
52+
export -f build_image
53+
##Rebuild
54+
"./runimage" bash -c "build_image"
55+
##End
56+
set +x
57+
popd >/dev/null 2>&1
58+
#-------------------------------------------------------#

0 commit comments

Comments
 (0)