name: SPT Release Build on: push: branches: [ main ] pull_request: branches: [ main ] jobs: check-tag-exists: runs-on: ubuntu-latest outputs: proceed: ${{ steps.check.outputs.proceed }} steps: - name: Check Tag Exists in All Repositories id: check run: | # The tag needs to be saved as a variable so that it can be used throughout the build process. TAG=3.8.0-BE-Test REPOS=("https://dev.sp-tarkov.com/SPT-AKI/Server.git" "https://dev.sp-tarkov.com/SPT-AKI/Modules.git" "https://dev.sp-tarkov.com/SPT-AKI/Launcher.git") PROCEED="true" for REPO in ${REPOS[@]}; do echo "Checking for tag $TAG in $REPO..." if ! git ls-remote --tags $REPO $TAG | grep -q $TAG; then echo "Tag $TAG not found in $REPO" PROCEED="false" break fi done echo "::set-output name=proceed::$PROCEED" shell: bash - name: Tag Not Found if: steps.check.outputs.proceed == 'false' run: | echo "Tag not found in one or more repositories, halting workflow." exit 1 build-server: needs: check-tag-exists if: needs.check-tag-exists.outputs.proceed == 'true' runs-on: ubuntu-latest container: image: refringe/spt-build-server:0.0.2 steps: - name: Clone run: | rm -rf /workspace/refringe/Build/server git clone https://dev.sp-tarkov.com/SPT-AKI/Server.git --branch 3.8.0-BE-Test --depth 1 /workspace/refringe/Build/server - name: Pull LFS Files run: | cd /workspace/refringe/Build/server git lfs pull && git lfs ls-files - name: Runner Debug Information run: | cd /workspace/refringe/Build/server echo "Git version: $(git --version)" echo "Git LFS version: $(git-lfs --version)" echo "Node.js version: $(node --version)" echo "NPM version: $(npm --version)" echo "Latest Commit Hash: $(git rev-parse HEAD)" echo "Associated Tags: $(git tag --contains HEAD)" echo "Last Commit Message:" && git log -1 --pretty=%B - name: Cache Keys id: cache-keys run: | cd /workspace/refringe/Build/server echo "::set-output name=commit_hash::$(git rev-parse HEAD)" TAGS=$(git tag --contains HEAD || echo "no-tag") if [ -z "$TAGS" ]; then TAGS="no-tag" fi TAGS="${TAGS//$'\n'/-}" # Replace newline characters with dashes TAGS="${TAGS//,/-}" # Replace commas with dashes echo "::set-output name=tags::${TAGS}" echo "Commit Hash: ${{ steps.cache-keys.outputs.commit_hash }}" echo "Tags: ${{ steps.cache-keys.outputs.tags }}" shell: bash - name: Determine Build Type id: build-type run: | TAGS="${{ steps.cache-keys.outputs.tags }}" BUILD_TYPE="debug" # Default if [[ "$TAGS" =~ -BE ]]; then BUILD_TYPE="bleeding" elif [[ "$TAGS" =~ ^(v?\d+\.\d+\.\d+)$ ]]; then BUILD_TYPE="release" fi echo "Build type: $BUILD_TYPE" echo "::set-output name=build_type::$BUILD_TYPE" shell: bash - name: Build Cache id: build-cache uses: actions/cache@v4 with: path: /workspace/refringe/Build/server/project/build key: build-${{ steps.cache-keys.outputs.commit_hash }}-${{ steps.cache-keys.outputs.tags }}-${{ steps.build-type.outputs.build_type }} restore-keys: | build-${{ steps.cache-keys.outputs.commit_hash }}-${{ steps.cache-keys.outputs.tags }}- build-${{ steps.cache-keys.outputs.commit_hash }}- build- - name: Install Dependencies if: steps.build-cache.outputs.cache-hit != 'true' run: | cd /workspace/refringe/Build/server/project npm install - name: Build Server if: steps.build-cache.outputs.cache-hit != 'true' run: | cd /workspace/refringe/Build/server/project BUILD_TYPE="${{ steps.build-type.outputs.build_type }}" echo "Running build for $BUILD_TYPE" npm run build:$BUILD_TYPE echo "\nBuilt!\n" tree -C /workspace/refringe/Build/server/project/build shell: bash - name: Archive Build uses: actions/upload-artifact@v3 with: name: server-build path: /workspace/refringe/Build/server/project/build/ overwrite: true build-modules: needs: check-tag-exists if: needs.check-tag-exists.outputs.proceed == 'true' runs-on: ubuntu-latest container: image: refringe/spt-build-dotnet:0.0.6 steps: - name: Clone run: | rm -rf /workspace/refringe/Build/modules git clone https://dev.sp-tarkov.com/SPT-AKI/Modules.git --branch 3.8.0-BE-Test --depth 1 /workspace/refringe/Build/modules - name: Fetch Server Core Config run: | rm -rf /workspace/refringe/Build/server-core git init /workspace/refringe/Build/server-core cd /workspace/refringe/Build/server-core git remote add origin https://dev.sp-tarkov.com/SPT-AKI/Server.git git config core.sparseCheckout true echo "project/assets/configs/core.json" >> .git/info/sparse-checkout git fetch --depth=1 origin 3.8.0-BE-Test git checkout FETCH_HEAD ls -la project/assets/configs shell: bash - name: Extract Client Version id: extract-client-version run: | cd /workspace/refringe/Build/server-core/project/assets/configs FULL_VERSION=$(jq -r '.compatibleTarkovVersion' core.json) CLIENT_VERSION=${FULL_VERSION##*.} echo "Extracted Client Version: $CLIENT_VERSION" echo "::set-output name=client_version::$CLIENT_VERSION" shell: bash - name: Download Client Module Package run: | DIR_MANAGED="/workspace/refringe/Build/modules/project/Shared/Managed" DOWNLOAD_PATH="$DIR_MANAGED/${{ steps.extract-client-version.outputs.client_version }}.zip" DOWNLOAD_URL="$MODULE_DOMAIN/${{ steps.extract-client-version.outputs.client_version }}.zip" echo "Downloading Client Module Package from $DOWNLOAD_URL to $DOWNLOAD_PATH" mkdir -p "$DIR_MANAGED" wget -q -O "$DOWNLOAD_PATH" "$DOWNLOAD_URL" || { echo "Failed to download the module package." exit 1 } if [ ! -s "$DOWNLOAD_PATH" ]; then echo "The module package does not exist or is empty." exit 1 fi echo "Download Successful: $DOWNLOAD_PATH" shell: bash env: MODULE_DOMAIN: ${{ secrets.MODULE_DOMAIN }} - name: Decompress Client Module Package run: | cd /workspace/refringe/Build/modules/project/Shared/Managed 7z x ${{ steps.extract-client-version.outputs.client_version }}.zip -aoa echo "Client module package decompressed." shell: bash - name: Delete Client Module Package run: | cd /workspace/refringe/Build/modules/project/Shared/Managed rm -f ${{ steps.extract-client-version.outputs.client_version }}.zip echo "Client module package deleted." shell: bash - name: Build Modules run: | cd /workspace/refringe/Build/modules/project dotnet build echo "\nBuilt!\n" tree /workspace/refringe/Build/modules/project/Build shell: bash - name: Archive Build uses: actions/upload-artifact@v3 with: name: modules-build path: /workspace/refringe/Build/modules/project/Build overwrite: true build-launcher: needs: check-tag-exists if: needs.check-tag-exists.outputs.proceed == 'true' runs-on: ubuntu-latest container: image: refringe/spt-build-dotnet:0.0.6 steps: - name: Clone run: | rm -rf /workspace/refringe/Build/launcher git clone https://dev.sp-tarkov.com/SPT-AKI/Launcher.git --branch 3.8.0-BE-Test --depth 1 /workspace/refringe/Build/launcher