enhance code quality

This commit is contained in:
minoplhy 2024-10-10 22:09:45 +07:00
parent a6f33c0655
commit 8746ad8f9c
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
4 changed files with 114 additions and 59 deletions

46
.github/workflows/forgejo-build.yaml vendored Normal file
View File

@ -0,0 +1,46 @@
name: forgejo Mega Build
run-name: forgejo Build
on:
push:
tags:
- forgejo-*
jobs:
build_forgejo:
runs-on: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up environment variables
run: |
TAG_NAME=${GITHUB_REF##*/}
GITEA_TAG=${TAG_NAME#forgejo-}
echo "GITEA_TAG=${GITEA_TAG}" >> $GITHUB_ENV
echo "GITEA_TAG=${GITEA_TAG}"
- name: Setup Package Directory
run: |
sudo mkdir -p /gitea-${GITEA_TAG}
- name: Run forgejo Build (binary + static)
run: |
echo "This Task will be run using the following tag: ${GITEA_TAG}"
curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.sh | bash -s -- --git-tag "${GITEA_TAG}" --static --type=forgejo
# Copy forgejo to package directory(this is due to a broken mechanism in origin script)
sudo cp ~/gitea-binaries/gitea /forgejo-${GITEA_TAG}/gitea
sudo cp -r ~/gitea-binaries/gitea-static /forgejo-${GITEA_TAG}/gitea-static
- name: Zip Package
run: |
sudo tar czvf forgejo-${GITEA_TAG}.tar.gz /forgejo-${GITEA_TAG}
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body: |
"forgejo Successfully build on -> ${{ env.GITEA_TAG }}"
token: ${{ secrets.DEPLOYMENT_TOKEN }}
files: forgejo-*.tar.gz

View File

@ -19,29 +19,37 @@ jobs:
echo "NGINX_TAG=${NGINX_TAG}" >> $GITHUB_ENV echo "NGINX_TAG=${NGINX_TAG}" >> $GITHUB_ENV
echo "NGINX_TAG=${NGINX_TAG}" echo "NGINX_TAG=${NGINX_TAG}"
- name: Run freenginx Build (Vanilla) TAGS=("vanilla" "allstar" "lua" "modsecurity")
run: | OPTIONS=(
echo "This Task will be run using the following tag: ${NGINX_TAG}" "--type=freenginx"
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --no-lua --no-modsecurity --type=freenginx "--lua --type=freenginx"
tar czvf nginx-${NGINX_TAG}-vanilla.tar.gz ~/nginx_scriptbox/nginx/objs "--lua --type=freenginx"
"--modsecurity --type=freenginx"
)
- name: Run freenginx Build (All Star) - name: Run freenginx Builds
run: | run: |
for i in ${!TAGS[@]}; do
echo "This Task will be run using the following tag: ${NGINX_TAG}" echo "This Task will be run using the following tag: ${NGINX_TAG}"
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --type=freenginx curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} ${OPTIONS[$i]}
tar czvf nginx-${NGINX_TAG}-allstar.tar.gz ~/nginx_scriptbox/nginx/objs /opt/nginx-lua-module /usr/local/lua /usr/local/modsecurity
- name: Run freenginx Build (Lua) # Prepare tar file paths
run: | TAR_PATH="~/nginx_scriptbox/nginx/objs" # Base Path
echo "This Task will be run using the following tag: ${NGINX_TAG}" case "${TAGS[$i]}" in
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --no-modsecurity --type=freenginx "allstar")
tar czvf nginx-${NGINX_TAG}-lua.tar.gz ~/nginx_scriptbox/nginx/objs /opt/nginx-lua-module /usr/local/lua TAR_PATH="$TAR_PATH /opt/nginx-lua-module /usr/local/lua /usr/local/modsecurity"
;;
"lua")
TAR_PATH="$TAR_PATH /opt/nginx-lua-module /usr/local/lua"
;;
"modsecurity")
TAR_PATH="$TAR_PATH /usr/local/modsecurity"
;;
esac
- name: Run freenginx Build (ModSecurity) # Create the tarball
run: | tar czvf freenginx-${NGINX_TAG}-${TAGS[$i]}.tar.gz $TAR_PATH
echo "This Task will be run using the following tag: ${NGINX_TAG}" done
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --no-lua --type=freenginx
tar czvf nginx-${NGINX_TAG}-modsecurity.tar.gz ~/nginx_scriptbox/nginx/objs /usr/local/modsecurity
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
@ -50,4 +58,4 @@ jobs:
body: | body: |
"freenginx Successfully build on -> ${{ env.NGINX_TAG }}" "freenginx Successfully build on -> ${{ env.NGINX_TAG }}"
token: ${{ secrets.DEPLOYMENT_TOKEN }} token: ${{ secrets.DEPLOYMENT_TOKEN }}
files: nginx-*.tar.gz files: freenginx-*.tar.gz

View File

@ -23,20 +23,13 @@ jobs:
run: | run: |
sudo mkdir -p /gitea-${GITEA_TAG} sudo mkdir -p /gitea-${GITEA_TAG}
- name: Run Gitea Build (binary) - name: Run Gitea Build (binary + static)
run: | run: |
echo "This Task will be run using the following tag: ${GITEA_TAG}" echo "This Task will be run using the following tag: ${GITEA_TAG}"
curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.sh | bash -s -- --git-tag "${GITEA_TAG}" curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.sh | bash -s -- --git-tag "${GITEA_TAG}" --static --type=gitea
# Copy gitea to package directory(this is due to a broken mechanism in origin script) # Copy gitea to package directory(this is due to a broken mechanism in origin script)
sudo cp ~/gitea-binaries/gitea /gitea-${GITEA_TAG}/gitea sudo cp ~/gitea-binaries/gitea /gitea-${GITEA_TAG}/gitea
- name: Run Gitea Build (static)
run: |
echo "This Task will be run using the following tag: ${GITEA_TAG}"
curl -L https://github.com/minoplhy/scriptbox/raw/main/build_gitea/Linux/build.sh | bash -s -- --git-tag "${GITEA_TAG}" --static
# Copy gitea to package directory(this is due to a broken mechanism in origin script)
sudo cp -r ~/gitea-binaries/gitea-static /gitea-${GITEA_TAG}/gitea-static sudo cp -r ~/gitea-binaries/gitea-static /gitea-${GITEA_TAG}/gitea-static
- name: Zip Package - name: Zip Package

View File

@ -1,5 +1,5 @@
name: Nginx Mega Build name: nginx Mega Build
run-name: Nginx Build run-name: nginx Build
on: on:
push: push:
tags: tags:
@ -19,35 +19,43 @@ jobs:
echo "NGINX_TAG=${NGINX_TAG}" >> $GITHUB_ENV echo "NGINX_TAG=${NGINX_TAG}" >> $GITHUB_ENV
echo "NGINX_TAG=${NGINX_TAG}" echo "NGINX_TAG=${NGINX_TAG}"
- name: Run Nginx Build (Vanilla) TAGS=("vanilla" "allstar" "lua" "modsecurity")
run: | OPTIONS=(
echo "This Task will be run using the following tag: ${NGINX_TAG}" "--type=nginx"
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --no-lua --no-modsecurity --type=nginx "--lua --type=nginx"
tar czvf nginx-${NGINX_TAG}-vanilla.tar.gz ~/nginx_scriptbox/nginx/objs "--lua --type=nginx"
"--modsecurity --type=nginx"
)
- name: Run Nginx Build (All Star) - name: Run nginx Builds
run: | run: |
for i in ${!TAGS[@]}; do
echo "This Task will be run using the following tag: ${NGINX_TAG}" echo "This Task will be run using the following tag: ${NGINX_TAG}"
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --type=nginx curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} ${OPTIONS[$i]}
tar czvf nginx-${NGINX_TAG}-allstar.tar.gz ~/nginx_scriptbox/nginx/objs /opt/nginx-lua-module /usr/local/lua /usr/local/modsecurity
- name: Run Nginx Build (Lua) # Prepare tar file paths
run: | TAR_PATH="~/nginx_scriptbox/nginx/objs" # Base Path
echo "This Task will be run using the following tag: ${NGINX_TAG}" case "${TAGS[$i]}" in
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --no-modsecurity --type=nginx "allstar")
tar czvf nginx-${NGINX_TAG}-lua.tar.gz ~/nginx_scriptbox/nginx/objs /opt/nginx-lua-module /usr/local/lua TAR_PATH="$TAR_PATH /opt/nginx-lua-module /usr/local/lua /usr/local/modsecurity"
;;
"lua")
TAR_PATH="$TAR_PATH /opt/nginx-lua-module /usr/local/lua"
;;
"modsecurity")
TAR_PATH="$TAR_PATH /usr/local/modsecurity"
;;
esac
- name: Run Nginx Build (ModSecurity) # Create the tarball
run: | tar czvf nginx-${NGINX_TAG}-${TAGS[$i]}.tar.gz $TAR_PATH
echo "This Task will be run using the following tag: ${NGINX_TAG}" done
curl https://raw.githubusercontent.com/minoplhy/scriptbox/main/nginx_build_script/build.sh | bash -s -- --nginx-tag=${NGINX_TAG} --no-lua --type=nginx
tar czvf nginx-${NGINX_TAG}-modsecurity.tar.gz ~/nginx_scriptbox/nginx/objs /usr/local/modsecurity
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
body: | body: |
"Nginx Successfully build on -> ${{ env.NGINX_TAG }}" "nginx Successfully build on -> ${{ env.NGINX_TAG }}"
token: ${{ secrets.DEPLOYMENT_TOKEN }} token: ${{ secrets.DEPLOYMENT_TOKEN }}
files: nginx-*.tar.gz files: nginx-*.tar.gz