Skip to content

fix: add --with-stream for geoip2 stream module, disable fail-fast #23

fix: add --with-stream for geoip2 stream module, disable fail-fast

fix: add --with-stream for geoip2 stream module, disable fail-fast #23

name: Build Nginx Dynamic Modules
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
nginx_version:
description: "Nginx version (e.g. 1.28.0)"
required: true
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os_name: jammy
arch: amd64
runner: ubuntu-22.04
- os_name: jammy
arch: arm64
runner: ubuntu-22.04-arm
- os_name: noble
arch: amd64
runner: ubuntu-24.04
- os_name: noble
arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Set Nginx version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "NGINX_VERSION=${{ inputs.nginx_version }}" >> $GITHUB_ENV
else
echo "NGINX_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
fi
- name: Validate Nginx version
run: |
if ! echo "$NGINX_VERSION" | grep -qP '^\d+\.\d+\.\d+(-\d+)?$'; then
echo "::error::Invalid nginx version: $NGINX_VERSION (expected format: x.y.z or x.y.z-n)"
exit 1
fi
echo "NGINX_BASE_VERSION=${NGINX_VERSION%-*}" >> $GITHUB_ENV
wget -q --spider "https://nginx.org/download/nginx-${NGINX_VERSION%-*}.tar.gz" || {
echo "::error::Nginx version $NGINX_VERSION not found on nginx.org"
exit 1
}
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libpcre3-dev zlib1g zlib1g-dev libssl-dev libmaxminddb-dev libbrotli-dev
- name: Download Nginx source
run: |
wget -q https://nginx.org/download/nginx-${NGINX_BASE_VERSION}.tar.gz
tar -xzf nginx-${NGINX_BASE_VERSION}.tar.gz
- name: Clone modules
run: |
git clone --depth 1 https://github.com/AirisX/nginx_cookie_flag_module.git
git clone --depth 1 https://github.com/openresty/headers-more-nginx-module.git
git clone --depth 1 --recurse-submodules https://github.com/google/ngx_brotli.git
git clone --depth 1 https://github.com/nginx-modules/ngx_cache_purge.git
git clone --depth 1 https://github.com/leev/ngx_http_geoip2_module.git
- name: Build modules
working-directory: nginx-${{ env.NGINX_BASE_VERSION }}
run: |
./configure --with-compat --with-stream \
--add-dynamic-module=../nginx_cookie_flag_module \
--add-dynamic-module=../headers-more-nginx-module \
--add-dynamic-module=../ngx_brotli \
--add-dynamic-module=../ngx_cache_purge \
--add-dynamic-module=../ngx_http_geoip2_module
make modules
- name: Prepare artifacts
run: |
mkdir -p output
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_http_cookie_flag_filter_module.so output/
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_http_headers_more_filter_module.so output/
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_http_brotli_filter_module.so output/
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_http_brotli_static_module.so output/
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_http_cache_purge_module.so output/
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_http_geoip2_module.so output/
cp nginx-${NGINX_BASE_VERSION}/objs/ngx_stream_geoip2_module.so output/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nginx-modules-${{ matrix.os_name }}-${{ matrix.arch }}
path: output/*.so
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Package artifacts
run: |
cd artifacts
for dir in */; do
name="${dir%/}"
tar -czf "${name}.tar.gz" -C "$dir" .
done
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*.tar.gz
generate_release_notes: true