build #1148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
env: | |
NPS_VERSION: 1.13.35.2-x64 | |
NPS_COMMIT: 71e24c1c47113acb5924d8cb523d572b376e9dd0 | |
name: Build nginx | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install requirements | |
run: sudo apt-get install jq build-essential zlib1g-dev libpcre3 libpcre3-dev unzip uuid-dev wget | |
- name: Get nginx release | |
run: | | |
NGINX_RELEASE=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/nginx/nginx/tags | jq -r .[0].name) | |
echo "NGINX_VERSION=${NGINX_RELEASE//release-}" >> $GITHUB_ENV | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- run: | | |
if git rev-parse ${{ env.NGINX_VERSION }} >/dev/null 2>&1; then | |
echo "${{ env.NGINX_VERSION }} exists" | |
else | |
echo "NGINX_BUILD=1" >> $GITHUB_ENV | |
fi | |
- name: Build | |
run: bash ./build.sh | |
if: "${{ env.NGINX_BUILD }}" | |
- name: Config | |
run: | | |
cp ./nginx.conf /opt/nginx/compiled/${{ env.NGINX_VERSION }}/conf/nginx.conf | |
if: "${{ env.NGINX_BUILD }}" | |
- name: Tar and compress | |
run: | | |
cd /opt/nginx/compiled | |
tar -czvf ${{ env.NGINX_VERSION }}.tar.gz ${{ env.NGINX_VERSION }} | |
if: "${{ env.NGINX_BUILD }}" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.NGINX_VERSION }} | |
release_name: Release ${{ env.NGINX_VERSION }} | |
draft: false | |
prerelease: false | |
if: "${{ env.NGINX_BUILD }}" | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: /opt/nginx/compiled/${{ env.NGINX_VERSION }}.tar.gz | |
asset_name: ${{ env.NGINX_VERSION }}.tar.gz | |
asset_content_type: application/gzip | |
if: "${{ env.NGINX_BUILD }}" |