-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (168 loc) · 7.11 KB
/
build_x86_64_Linux.yaml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: 🛍️ Build 📀 (x86_64-Linux) FlatImages 📦📀
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * 3" # @ 06:00 AM UTC (11:45 AM NPT Morning Thu)
jobs:
#------------------------------------------------------------------------------------#
build:
runs-on: ubuntu-latest
timeout-minutes: 180
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Install Addons
run: |
#presets
set -x ; set +e
#-------------#
bash <(curl -qfsSL "https://pub.ajam.dev/repos/Azathothas/Arsenal/misc/Linux/install_dev_tools.sh")
continue-on-error: true
- name: Setup Env
run: |
##presets
set +x ; set +e
#-------------#
##CoreUtils
sudo apt update -y
sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y
sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null
##tmp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
#GH ENV
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
#-------------#
mkdir -p "${HOME}/bin"
sudo apt update -y
sudo apt install dos2unix -y
##User-Agent
USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}"
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
continue-on-error: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
continue-on-error: true
- name: Build
env:
GITHUB_TOKEN: "${{ github.token }}"
run: |
##presets
set +x ; set +e
#-------------#
pushd "$(mktemp -d)" >/dev/null 2>&1
chmod +x "${GITHUB_WORKSPACE}/main/build.sh"
dos2unix --quiet "${GITHUB_WORKSPACE}/main/build.sh"
shellcheck --exclude="SC2261" --severity="error" "${GITHUB_WORKSPACE}/main/build.sh"
"${GITHUB_WORKSPACE}/main/build.sh"
eget "https://github.com/Jguer/yay" --asset "$(uname -m)" --file "yay" --to "/tmp/FLATIMAGES/yay"
eget "https://github.com/Morganamilo/paru" --asset "$(uname -m)" --file "paru" --to "/tmp/FLATIMAGES/paru"
eget "https://github.com/VHSgunzo/runimage-fake-sudo-pkexec" --asset "any" --asset "tar.zst" --download-only --to "/tmp/FLATIMAGES/fake-sudo-pkexec.tar.zst"
#Sanity Checks
if [ -d "/tmp/FLATIMAGES" ] && [ "$(find "/tmp/FLATIMAGES" -mindepth 1 -print -quit 2>/dev/null)" ]; then
#Gen Release Notes
cd "/tmp/FLATIMAGES" && find "." -type f | xargs realpath
find "./" -maxdepth 1 -type f | sort | grep -v -E '\.tar$|\.txt$|\.xz$' | xargs file | sort -u -o "./FILE.txt"
find "./" -maxdepth 1 -type f | sort | grep -v -E '\.tar$|\.txt$|\.xz$' | xargs sha256sum | sort -u -o "./SHA256SUM.txt"
#INFO
readarray -d '' FIM_IMGS < <(find "." -name '*.flatimage' -print0)
for FIM_IMG in "${FIM_IMGS[@]}"; do
FIM_IMG_B="${FIM_IMG%.flatimage}"
{
"${FIM_IMG}" fim-root cat "/etc/os-release"
"${FIM_IMG}" fim-root ldd --version
} &> "${FIM_IMG_B}.txt"
done
#GH ENV
export HAS_RELEASE="TRUE"
echo "HAS_RELEASE=${HAS_RELEASE}" >> "${GITHUB_ENV}"
else
export HAS_RELEASE="FALSE"
echo "HAS_RELEASE=${HAS_RELEASE}" >> "${GITHUB_ENV}"
exit 1
fi
continue-on-error: true
- name: Fail (If Build Failed)
if: env.HAS_RELEASE == 'FALSE'
run: |
#presets
set +x ; set +e
#-------------#
exit 1
continue-on-error: false
- name: Get Release ENV & Tags
if: env.HAS_RELEASE == 'TRUE'
run: |
#presets
set +x ; set +e
#-------------#
#Arch
B_ARCH="$(uname -m)" && export B_ARCH="${B_ARCH}"
echo "B_ARCH=${B_ARCH}" >> "${GITHUB_ENV}"
#Time
UTC_TIME="$(TZ='UTC' date +'%Y_%m_%d')"
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
#VERSION
pushd "$(mktemp -d)" >/dev/null 2>&1
git clone --filter="blob:none" --depth="1" --quiet "https://github.com/ruanformigoni/flatimage" && cd "./flatimage"
FIM_VERSION="$(git tag --sort="-v:refname" | head -n 1 | tr -d "[:space:]")" && export FIM_VERSION="${FIM_VERSION}"
if [[ -z "${FIM_VERSION}" ]]; then
FIM_VERSION="$(git log --oneline --format="%h" | head -n 1 | tr -d "[:space:]")" && export FIM_VERSION="${FIM_VERSION}"
fi
echo "FIM_VERSION=${FIM_VERSION}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Create Body for Release
if: env.HAS_RELEASE == 'TRUE'
run: |
#presets
set +x ; set +e
#-------------#
echo -e "" >> "/tmp/RELEASE_NOTE.md"
echo '---' >> "/tmp/RELEASE_NOTE.md"
echo '```console' >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
echo -e "[+] --> Metadata (Version: ${FIM_VERSION})" >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
cat "/tmp/FLATIMAGES/FILE.txt" >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
echo -e "[+] --> SHA256SUM" >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
cat "/tmp/FLATIMAGES/SHA256SUM.txt" >> "/tmp/RELEASE_NOTE.md"
echo -e '```\n' >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
continue-on-error: true
#continuous
- name: Releaser (Continuous)
if: env.HAS_RELEASE == 'TRUE'
uses: softprops/[email protected]
with:
name: "Continuous ${{ env.B_ARCH }}"
tag_name: "${{ env.B_ARCH }}"
prerelease: true
draft: false
generate_release_notes: false
body_path: "/tmp/RELEASE_NOTE.md"
files: |
/tmp/FLATIMAGES/*
continue-on-error: true
#Snapshot
- name: Releaser (Snapshot)
if: env.HAS_RELEASE == 'TRUE'
uses: softprops/[email protected]
with:
name: "FLATIMAGE-(${{ env.FIM_VERSION}})-${{ env.UTC_TIME }}-${{ env.B_ARCH }}"
tag_name: "${{ env.UTC_TIME }}-${{ env.B_ARCH }}"
prerelease: false
draft: false
generate_release_notes: false
make_latest: false
body_path: "/tmp/RELEASE_NOTE.md"
files: |
/tmp/FLATIMAGES/*
continue-on-error: true