From da81fe511d2efe4e2c898b68f7a2c8d46922a13b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 5 Sep 2023 20:08:20 +0700 Subject: [PATCH] Update workflows/build.yml --- .github/workflows/build.yml | 61 ++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b191a309..2f8746ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v1.1.3 + with: + vs-version: '16.8' - name: Build run: | @@ -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/* @@ -52,10 +54,12 @@ 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 @@ -63,6 +67,21 @@ jobs: 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 @@ -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: | @@ -86,17 +104,12 @@ 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 @@ -104,29 +117,15 @@ jobs: 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: | @@ -134,7 +133,7 @@ jobs: 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 @@ -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