Update main.yml

This commit is contained in:
𝓙𝓾𝓵𝓲𝓸
2024-09-01 05:12:52 +02:00
committed by GitHub
parent 14a7a13738
commit 2a57da27dd
+69 -56
View File
@@ -11,83 +11,96 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get -y update sudo apt-get update
sudo apt-get -y install git dpkg-dev build-essential sudo apt-get -y install git dpkg-dev
- name: Clone the repository - name: Clone the repository
run: | run: |
git clone https://github.com/theraw/The-World-Is-Yours.git $GITHUB_WORKSPACE/The-World-Is-Yours cd /root/
git clone https://github.com/theraw/The-World-Is-Yours.git
cd The-World-Is-Yours/
- name: Build NGINX - name: Build NGINX
run: | run: |
cd $GITHUB_WORKSPACE/The-World-Is-Yours cd /root/The-World-Is-Yours/
sudo bash build/run.sh new sudo bash build/run.sh new
sudo bash build/run.sh build sudo bash build/run.sh build
sudo bash build/run.sh postfix sudo bash build/run.sh postfix
- name: Build .deb Package - name: Build .deb Package
run: | run: |
cd $GITHUB_WORKSPACE/The-World-Is-Yours cd /root/The-World-Is-Yours/
sudo bash -c ' sudo bash -c 'function create_deb() {
PKG_NAME="twiy" PKG_NAME="twiy"
VERSION=$(nginx -v 2>&1 | awk -F"/" "{print \$2}") VERSION=$(nginx -v 2>&1 | awk -F"/" "{print \$2}")
ARCH="amd64" ARCH="amd64"
PKG_DIR="$GITHUB_WORKSPACE/${PKG_NAME}_${VERSION}_${ARCH}" PKG_DIR="/opt/${PKG_NAME}_${VERSION}_${ARCH}"
DEB_DIR="${PKG_DIR}/DEBIAN" DEB_DIR="${PKG_DIR}/DEBIAN"
mkdir -p ${PKG_DIR}/usr/sbin mkdir -p ${PKG_DIR}/usr/sbin
mkdir -p ${PKG_DIR}/usr/local/nginx mkdir -p ${PKG_DIR}/usr/local/nginx
mkdir -p ${PKG_DIR}/nginx mkdir -p ${PKG_DIR}/nginx
mkdir -p ${PKG_DIR}/etc/systemd/system mkdir -p ${PKG_DIR}/etc/systemd/system
mkdir -p ${PKG_DIR}/var/log/nginx mkdir -p ${PKG_DIR}/var/log/nginx
mkdir -p ${PKG_DIR}/nginx/conf.d mkdir -p ${PKG_DIR}/nginx/conf.d
mkdir -p ${PKG_DIR}/nginx/live mkdir -p ${PKG_DIR}/nginx/live
mkdir -p ${PKG_DIR}/nginx/modsec mkdir -p ${PKG_DIR}/nginx/modsec
mkdir -p ${PKG_DIR}/usr/lib mkdir -p ${PKG_DIR}/usr/lib
mkdir -p ${PKG_DIR}/usr/local/lib mkdir -p ${PKG_DIR}/usr/local/lib
mkdir -p ${PKG_DIR}/hostdata/default/public_html mkdir -p ${PKG_DIR}/hostdata/default/public_html
mkdir -p ${PKG_DIR}/usr/nginx_lua mkdir -p ${PKG_DIR}/usr/nginx_lua
cp /usr/sbin/nginx ${PKG_DIR}/usr/sbin/
cp -R /nginx/* ${PKG_DIR}/nginx/ cp /usr/sbin/nginx ${PKG_DIR}/usr/sbin/
cp /etc/systemd/system/nginx.service ${PKG_DIR}/etc/systemd/system/ cp -R /nginx/* ${PKG_DIR}/nginx/
cp -R /hostdata/default ${PKG_DIR}/hostdata/ cp /etc/systemd/system/nginx.service ${PKG_DIR}/etc/systemd/system/
cp -R /usr/nginx_lua ${PKG_DIR}/usr/ cp -R /hostdata/default ${PKG_DIR}/hostdata/
for lib in $(ldd /usr/sbin/nginx | grep "=> /" | awk "{print \$3}"); do cp -R /usr/nginx_lua ${PKG_DIR}/usr/
cp "$lib" "${PKG_DIR}/usr/lib/"
done for lib in $(ldd /usr/sbin/nginx | grep "=> /" | awk "{print \$3}"); do
for module in /opt/mod/*; do cp "$lib" "${PKG_DIR}/usr/lib/"
if [ -f "$module" ]; then done
for lib in $(ldd "$module" | grep "=> /" | awk "{print \$3}"); do
cp "$lib" "${PKG_DIR}/usr/lib/" for module in /opt/mod/*; do
done if [ -f "$module" ]; then
fi for lib in $(ldd "$module" | grep "=> /" | awk "{print \$3}"); do
done cp "$lib" "${PKG_DIR}/usr/lib/"
mkdir -p ${DEB_DIR} done
echo "Package: ${PKG_NAME}" > ${DEB_DIR}/control fi
echo "Version: ${VERSION}" >> ${DEB_DIR}/control done
echo "Section: base" >> ${DEB_DIR}/control
echo "Priority: optional" >> ${DEB_DIR}/control mkdir -p ${DEB_DIR}
echo "Architecture: ${ARCH}" >> ${DEB_DIR}/control cat <<EOL > ${DEB_DIR}/control
echo "Maintainer: theraw <me@julio.al>" >> ${DEB_DIR}/control Package: ${PKG_NAME}
echo "Description: Custom NGINX build with modules and dependencies" >> ${DEB_DIR}/control Version: ${VERSION}
cat <<'EOF' > ${DEB_DIR}/postinst Section: base
#!/bin/bash Priority: optional
useradd -r -d /usr/local/nginx -s /bin/false nginx || true Architecture: ${ARCH}
EOF Maintainer: You <you@example.com>
chmod 755 ${DEB_DIR}/postinst Description: Custom NGINX build with modules and dependencies
dpkg-deb --build ${PKG_DIR} EOL
mv ${PKG_DIR}.deb $GITHUB_WORKSPACE/${PKG_NAME}_${VERSION}_${ARCH}.deb
echo "Debian package created at $GITHUB_WORKSPACE/${PKG_NAME}_${VERSION}_${ARCH}.deb" cat <<'POSTINST_EOF' > ${DEB_DIR}/postinst
' #!/bin/bash
useradd -r -d /usr/local/nginx -s /bin/false nginx || true
POSTINST_EOF
chmod 755 ${DEB_DIR}/postinst
dpkg-deb --build ${PKG_DIR}
mv ${PKG_DIR}.deb /opt/${PKG_NAME}_${VERSION}_${ARCH}.deb
echo "Debian package created at /opt/${PKG_NAME}_${VERSION}_${ARCH}.deb"
}; create_deb'
- name: Upload .deb Package as Artifact - name: Upload .deb Package as Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: twiy-nginx-deb name: twiy-nginx-deb
path: $GITHUB_WORKSPACE/*.deb path: /opt/*.deb