From 2a8d60a89e12b992d577e5f82785b7d1fdc99f57 Mon Sep 17 00:00:00 2001 From: Mikk155 Date: Sat, 7 Sep 2024 02:35:04 -0300 Subject: [PATCH] ci-cd --- .github/workflows/ci-cd.yml | 77 ++--------------- .github/workflows/release.yml | 156 ++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index c75fe37ff..fb4b7ae22 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -4,55 +4,15 @@ on: push: branches: - master - paths: - - '.github/workflows/ci-cd.yml' env: - VERSION: 0.0.1 - USER: Mikk155 - REPOSITORY: unity BUILD_TYPE: Release GAME_NAME: Half-Life MOD_NAME: unity VCPKG_ROOT: ${{github.workspace}}/vcpkg jobs: - release: - name: release - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.11.4' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --no-cache-dir -r requirements.txt - pip install --upgrade pip - - - name: Build FGD - run: | - cd src/data - python main.py - - - name: release - id: generated - env: - TOKEN: ${{ secrets.TOKEN }} - VERSION: ${{ env.VERSION }} - USER: ${{ env.USER }} - REPOSITORY: ${{ env.REPOSITORY }} - GAME_NAME: ${{ env.GAME_NAME }} - MOD_NAME: ${{ env.MOD_NAME }} - run: python3 build.py - linux: - needs: release name: Linux-x86 runs-on: ubuntu-latest steps: @@ -61,10 +21,6 @@ jobs: with: submodules: recursive - - name: Pre-Release - if: success() && needs.release.outputs.generated - run: echo "Waiting for release task." - - name: Install G++ Multilib & 32 bit OpenGL library run: | sudo dpkg --add-architecture i386 @@ -95,19 +51,13 @@ jobs: - name: Zip Binaries run: zip -r Linux-x86 ${{ env.GAME_NAME }} - - name: Release - uses: xresloader/upload-to-github-release@v1.6.0 + - name: Upload artifacts + uses: actions/upload-artifact@v4 with: - file: Linux-x86.zip - tag_name: ${{ env.VERSION }} - token: ${{ secrets.TOKEN }} - target_owner: ${{ env.USER }} - target_repo: ${{ env.REPOSITORY }} - prerelease: true - tags: true - + name: Linux-x86 + path: ${{env.GAME_NAME}} + win32: - needs: release name: Win32 runs-on: windows-latest steps: @@ -116,10 +66,6 @@ jobs: with: submodules: recursive - - name: Pre-Release - if: success() && needs.release.outputs.generated - run: echo "Waiting for release task." - - uses: lukka/get-cmake@latest - name: setup vcpkg @@ -144,13 +90,8 @@ jobs: run: | powershell Compress-Archive -Path ${{ env.GAME_NAME }} -DestinationPath Win32.zip - - name: Release - uses: xresloader/upload-to-github-release@v1.6.0 + - name: Upload artifacts + uses: actions/upload-artifact@v4 with: - file: Win32.zip - tag_name: ${{ env.VERSION }} - token: ${{ secrets.TOKEN }} - target_owner: ${{ env.USER }} - target_repo: ${{ env.REPOSITORY }} - prerelease: true - tags: true + name: Win32 + path: ${{env.GAME_NAME}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..1a180c5be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,156 @@ +name: release + +on: + push: + branches: + - master + paths: + - '.github/workflows/ci-cd.yml' + +env: + VERSION: 0.0.1 + USER: Mikk155 + REPOSITORY: unity + BUILD_TYPE: Release + GAME_NAME: Half-Life + MOD_NAME: unity + VCPKG_ROOT: ${{github.workspace}}/vcpkg + +jobs: + release: + name: release + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11.4' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --no-cache-dir -r requirements.txt + pip install --upgrade pip + + - name: Build FGD + run: | + cd src/data + python main.py + + - name: release + id: generated + env: + TOKEN: ${{ secrets.TOKEN }} + VERSION: ${{ env.VERSION }} + USER: ${{ env.USER }} + REPOSITORY: ${{ env.REPOSITORY }} + GAME_NAME: ${{ env.GAME_NAME }} + MOD_NAME: ${{ env.MOD_NAME }} + run: python3 build.py + + linux: + needs: release + name: Linux-x86 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Pre-Release + if: success() && needs.release.outputs.generated + run: echo "Waiting for release task." + + - name: Install G++ Multilib & 32 bit OpenGL library + run: | + sudo dpkg --add-architecture i386 + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt update + sudo apt install -y g++-11-multilib libgcc-s1:i386 libstdc++6:i386 libatomic1:i386 libgl1-mesa-dev:i386 + + - uses: lukka/get-cmake@latest + + - name: setup vcpkg + uses: lukka/run-vcpkg@v10 + with: + vcpkgDirectory: '${{env.VCPKG_ROOT}}' + runVcpkgInstall: false + vcpkgJsonIgnores: "['**/vcpkg/**', '**/vcpkg_config/**', '**/utils/**']" + + - name: Configure + run: > + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.GAME_NAME}}/${{env.MOD_NAME}} + -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/cmake/LinuxToolchain.cmake + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j3 + + - name: Install + run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Zip Binaries + run: zip -r Linux-x86 ${{ env.GAME_NAME }} + + - name: Release + uses: xresloader/upload-to-github-release@v1.6.0 + with: + file: Linux-x86.zip + tag_name: ${{ env.VERSION }} + token: ${{ secrets.TOKEN }} + target_owner: ${{ env.USER }} + target_repo: ${{ env.REPOSITORY }} + prerelease: true + tags: true + + win32: + needs: release + name: Win32 + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Pre-Release + if: success() && needs.release.outputs.generated + run: echo "Waiting for release task." + + - uses: lukka/get-cmake@latest + + - name: setup vcpkg + uses: lukka/run-vcpkg@v10 + with: + vcpkgDirectory: '${{env.VCPKG_ROOT}}' + runVcpkgInstall: false + vcpkgJsonIgnores: "['**/vcpkg/**', '**/vcpkg_config/**', '**/utils/**']" + + - name: Configure + run: > + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.GAME_NAME}}/${{env.MOD_NAME}} + -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/cmake/WindowsToolchain.cmake -A Win32 + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j3 + + - name: Install + run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Zip Binaries + run: | + powershell Compress-Archive -Path ${{ env.GAME_NAME }} -DestinationPath Win32.zip + + - name: Release + uses: xresloader/upload-to-github-release@v1.6.0 + with: + file: Win32.zip + tag_name: ${{ env.VERSION }} + token: ${{ secrets.TOKEN }} + target_owner: ${{ env.USER }} + target_repo: ${{ env.REPOSITORY }} + prerelease: true + tags: true