diff --git a/.gitea/workflows/build-publish.yml b/.gitea/workflows/build-publish.yml index b22583a..9be5f53 100644 --- a/.gitea/workflows/build-publish.yml +++ b/.gitea/workflows/build-publish.yml @@ -71,8 +71,7 @@ jobs: sudo chmod 755 "${DEB_DIR}/postinst" sudo dpkg-deb --build "${PKG_DIR}" - DEB_FILE="/opt/${PKG_NAME}_${VERSION}_${ARCH}.deb" - sudo mv "${PKG_DIR}.deb" "${DEB_FILE}" + DEB_FILE="${PKG_DIR}.deb" echo "deb_file=${DEB_FILE}" >> "$GITHUB_OUTPUT" echo "version=${VERSION}" >> "$GITHUB_OUTPUT" echo "pkg_name=${PKG_NAME}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 1c4703b..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Build and Publish NGINX - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get -y install git dpkg-dev - - - name: Clone the repository - run: | - cd $HOME - git clone https://github.com/theraw/The-World-Is-Yours.git - cd The-World-Is-Yours/ - - - name: Build NGINX - run: | - touch $HOME/.dockerenv - cd $HOME/The-World-Is-Yours/ - sudo bash build/run.sh new - sudo bash build/run.sh build - sudo bash build/run.sh postfix - - - name: Build .deb Package - id: build_deb - run: | - cd $HOME/The-World-Is-Yours/ - sudo bash -c 'function create_deb() { - PKG_NAME="twiy" - VERSION=$(nginx -v 2>&1 | awk -F"/" "{print \$2}") - ARCH="amd64" - PKG_DIR="/opt/${PKG_NAME}_${VERSION}_${ARCH}" - DEB_DIR="${PKG_DIR}/DEBIAN" - mkdir -p ${PKG_DIR}/usr/sbin - mkdir -p ${PKG_DIR}/usr/local/nginx - mkdir -p ${PKG_DIR}/nginx - mkdir -p ${PKG_DIR}/etc/systemd/system - mkdir -p ${PKG_DIR}/var/log/nginx - mkdir -p ${PKG_DIR}/nginx/conf.d - mkdir -p ${PKG_DIR}/nginx/live - mkdir -p ${PKG_DIR}/nginx/modsec - mkdir -p ${PKG_DIR}/usr/lib - mkdir -p ${PKG_DIR}/usr/local/lib - mkdir -p ${PKG_DIR}/hostdata/default/public_html - mkdir -p ${PKG_DIR}/usr/nginx_lua - cp /usr/sbin/nginx ${PKG_DIR}/usr/sbin/ - cp -R /nginx/* ${PKG_DIR}/nginx/ - cp /etc/systemd/system/nginx.service ${PKG_DIR}/etc/systemd/system/ - cp -R /hostdata/default ${PKG_DIR}/hostdata/ - cp -R /usr/nginx_lua ${PKG_DIR}/usr/ - for lib in $(ldd /usr/sbin/nginx | grep "=> /" | awk "{print \$3}"); do - cp "$lib" "${PKG_DIR}/usr/lib/" - done - for module in /opt/mod/*; do - if [ -f "$module" ]; then - for lib in $(ldd "$module" | grep "=> /" | awk "{print \$3}"); do - cp "$lib" "${PKG_DIR}/usr/lib/" - done - fi - done - mkdir -p ${DEB_DIR} - echo "Package: ${PKG_NAME}" > ${DEB_DIR}/control - echo "Version: ${VERSION}" >> ${DEB_DIR}/control - echo "Section: base" >> ${DEB_DIR}/control - echo "Priority: optional" >> ${DEB_DIR}/control - echo "Architecture: ${ARCH}" >> ${DEB_DIR}/control - echo "Maintainer: Julio " >> ${DEB_DIR}/control - echo "Description: Nginx L7 DDoS Protection! And many more features github.com/theraw/The-World-Is-Yours" >> ${DEB_DIR}/control - echo "#!/bin/bash" > ${DEB_DIR}/postinst - echo "useradd -r -d /usr/local/nginx -s /bin/false nginx || true" >> ${DEB_DIR}/postinst - chmod 755 ${DEB_DIR}/postinst - chmod -R 0755 ${DEB_DIR} - 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" - echo "::set-output name=VERSION::${VERSION}" - }; create_deb' - - - name: Create Git Tag - run: | - VERSION=${{ steps.build_deb.outputs.VERSION }} - git config user.name "theraw" - git config user.email "me@julio.al" - git tag v$VERSION - git push origin v$VERSION - - - name: Upload .deb Package as Release Asset - uses: softprops/action-gh-release@v2 - with: - files: /opt/*.deb - tag_name: v${{ steps.build_deb.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}