Skip to content

Commit

Permalink
Update workflows/build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Sep 5, 2023
1 parent eab1658 commit da81fe5
Showing 1 changed file with 27 additions and 34 deletions.
61 changes: 27 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup MSBuild
uses: microsoft/[email protected]
uses: microsoft/[email protected]
with:
vs-version: '16.8'

- name: Build
run: |
Expand All @@ -43,7 +45,7 @@ jobs:
move msvc\${{ env.buildRelease }}\reapi_amxx.pdb publish\debug\reapi_amxx.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.1.1
with:
name: win32
path: publish/*
Expand All @@ -52,17 +54,34 @@ jobs:
name: 'Linux'
runs-on: ubuntu-latest
container: s1lentq/linux86buildtools:latest
outputs:
app-version: ${{ steps.app-version.outputs.version }}

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build using Intel C++ Compiler 19.0
run: |
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8
- name: Reading appversion.h
id: app-version
run: |
if [ -e "reapi/version/appversion.h" ]; then
APP_VERSION=$(cat "reapi/version/appversion.h" | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
APP_VERSION=""
else
# Remove quotes
APP_VERSION=$(echo $APP_VERSION | xargs)
fi
fi
echo "version=${APP_VERSION}" >> "$GITHUB_OUTPUT"
shell: bash

- name: Prepare AMXX
run: |
mkdir -p publish/addons/amxmodx/modules
Expand All @@ -72,7 +91,6 @@ jobs:
- name: Move files
run: |
mv build/reapi/reapi_amxx_i386.so publish/addons/amxmodx/modules/reapi_amxx_i386.so
mv reapi/version/appversion.h publish/appversion.h
- name: Run GLIBC/ABI version compat test
run: |
Expand All @@ -86,55 +104,36 @@ jobs:
shell: bash

- name: Deploy artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.1.1
id: upload-job
with:
name: linux32
path: publish/*

- name: Cleanup temporary artifacts
if: success() && steps.upload-job.outcome == 'success'
run: |
rm -f appversion.h
publish:
name: 'Publish'
runs-on: ubuntu-latest
needs: [windows, linux]

steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: linux32

- name: Deploying windows artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: win32

- name: Reading appversion.h
run: |
if [ -e appversion.h ]; then
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
APP_VERSION=""
else
# Remove quotes
APP_VERSION=$(echo $APP_VERSION | xargs)
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
fi
fi
rm -f appversion.h
- name: Packaging binaries
id: packaging-job
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
run: |
7z a -tzip reapi-bin-${{ env.APP_VERSION }}.zip addons/
7z a -tzip reapi-bin-${{ needs.linux.outputs.app-version }}.zip addons/
- name: Publish artifacts
uses: softprops/action-gh-release@v1
Expand All @@ -147,9 +146,3 @@ jobs:
*.zip
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}

- name: Cleanup temporary artifacts
if: success() && steps.publish-job.outcome == 'success'
run: |
rm -rf addons debug
rm -f *.zip appversion.h

0 comments on commit da81fe5

Please sign in to comment.