2024-02-29 21:44:53 -05:00
|
|
|
name: SPT Release Build
|
2024-02-29 21:25:58 -05:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
jobs:
|
2024-03-02 22:46:27 -05:00
|
|
|
check-tag-exists:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
proceed: ${{ steps.check.outputs.proceed }}
|
|
|
|
steps:
|
|
|
|
- name: Check Tag Exists in All Repositories
|
|
|
|
id: check
|
|
|
|
run: |
|
2024-03-04 21:09:03 -05:00
|
|
|
# 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
|
2024-03-02 22:46:27 -05:00
|
|
|
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'
|
2024-02-29 21:25:58 -05:00
|
|
|
runs-on: ubuntu-latest
|
2024-03-01 11:12:38 -05:00
|
|
|
container:
|
2024-03-04 21:46:32 -05:00
|
|
|
image: refringe/spt-build-server:0.0.2
|
2024-02-29 21:25:58 -05:00
|
|
|
steps:
|
2024-03-02 14:42:07 -05:00
|
|
|
- name: Clone
|
|
|
|
run: |
|
|
|
|
rm -rf ./server
|
2024-03-04 21:09:03 -05:00
|
|
|
git clone https://dev.sp-tarkov.com/SPT-AKI/Server.git --branch 3.8.0-BE-Test --depth 1 ./server
|
2024-03-02 14:42:07 -05:00
|
|
|
|
|
|
|
- name: Pull LFS Files
|
2024-03-02 14:48:27 -05:00
|
|
|
run: |
|
|
|
|
cd ./server
|
|
|
|
git lfs pull && git lfs ls-files
|
2024-03-02 14:42:07 -05:00
|
|
|
|
|
|
|
- name: Runner Debug Information
|
2024-03-02 13:59:49 -05:00
|
|
|
run: |
|
2024-03-02 14:48:27 -05:00
|
|
|
cd ./server
|
2024-03-02 14:38:19 -05:00
|
|
|
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)"
|
2024-03-02 14:52:00 -05:00
|
|
|
echo "Last Commit Message:" && git log -1 --pretty=%B
|
2024-03-01 18:54:44 -05:00
|
|
|
|
2024-03-02 14:38:19 -05:00
|
|
|
- name: Cache Keys
|
|
|
|
id: cache-keys
|
|
|
|
run: |
|
2024-03-02 14:48:27 -05:00
|
|
|
cd ./server
|
2024-03-02 14:38:19 -05:00
|
|
|
echo "::set-output name=commit_hash::$(git rev-parse HEAD)"
|
2024-03-02 14:52:00 -05:00
|
|
|
TAGS=$(git tag --contains HEAD || echo "no-tag")
|
|
|
|
if [ -z "$TAGS" ]; then
|
2024-03-02 14:38:19 -05:00
|
|
|
TAGS="no-tag"
|
|
|
|
fi
|
2024-03-02 14:56:28 -05:00
|
|
|
TAGS="${TAGS//$'\n'/-}" # Replace newline characters with dashes
|
|
|
|
TAGS="${TAGS//,/-}" # Replace commas with dashes
|
|
|
|
echo "::set-output name=tags::${TAGS}"
|
2024-03-02 14:38:19 -05:00
|
|
|
echo "Commit Hash: ${{ steps.cache-keys.outputs.commit_hash }}"
|
|
|
|
echo "Tags: ${{ steps.cache-keys.outputs.tags }}"
|
2024-03-02 14:52:00 -05:00
|
|
|
shell: bash
|
2024-03-02 14:38:19 -05:00
|
|
|
|
2024-03-02 21:57:09 -05:00
|
|
|
- name: Determine Build Type
|
2024-03-02 15:09:22 -05:00
|
|
|
id: build-type
|
|
|
|
run: |
|
2024-03-02 21:57:09 -05:00
|
|
|
TAGS="${{ steps.cache-keys.outputs.tags }}"
|
2024-03-02 15:30:22 -05:00
|
|
|
BUILD_TYPE="debug" # Default
|
2024-03-02 21:57:09 -05:00
|
|
|
if [[ "$TAGS" =~ -BE ]]; then
|
|
|
|
BUILD_TYPE="bleeding"
|
|
|
|
elif [[ "$TAGS" =~ ^(v?\d+\.\d+\.\d+)$ ]]; then
|
|
|
|
BUILD_TYPE="release"
|
|
|
|
fi
|
2024-03-02 15:25:43 -05:00
|
|
|
echo "Build type: $BUILD_TYPE"
|
|
|
|
echo "::set-output name=build_type::$BUILD_TYPE"
|
2024-03-02 15:09:22 -05:00
|
|
|
shell: bash
|
|
|
|
|
2024-03-02 14:38:19 -05:00
|
|
|
- name: Build Cache
|
|
|
|
id: build-cache
|
2024-03-01 16:35:27 -05:00
|
|
|
uses: actions/cache@v4
|
2024-03-01 16:29:25 -05:00
|
|
|
with:
|
2024-03-02 14:38:19 -05:00
|
|
|
path: ./server/project/build
|
2024-03-02 15:09:22 -05:00
|
|
|
key: build-${{ steps.cache-keys.outputs.commit_hash }}-${{ steps.cache-keys.outputs.tags }}-${{ steps.build-type.outputs.build_type }}
|
2024-03-02 14:38:19 -05:00
|
|
|
restore-keys: |
|
2024-03-02 15:09:22 -05:00
|
|
|
build-${{ steps.cache-keys.outputs.commit_hash }}-${{ steps.cache-keys.outputs.tags }}-
|
2024-03-02 14:38:19 -05:00
|
|
|
build-${{ steps.cache-keys.outputs.commit_hash }}-
|
|
|
|
build-
|
2024-03-01 13:19:08 -05:00
|
|
|
|
2024-03-02 14:07:51 -05:00
|
|
|
- name: Install Dependencies
|
2024-03-02 14:38:19 -05:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2024-03-02 14:48:27 -05:00
|
|
|
run: |
|
|
|
|
cd ./server/project
|
|
|
|
npm install
|
2024-03-02 13:59:49 -05:00
|
|
|
|
2024-03-02 14:07:51 -05:00
|
|
|
- name: Build Server
|
2024-03-02 14:38:19 -05:00
|
|
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
2024-03-02 14:48:27 -05:00
|
|
|
run: |
|
|
|
|
cd ./server/project
|
2024-03-02 15:09:22 -05:00
|
|
|
BUILD_TYPE="${{ steps.build-type.outputs.build_type }}"
|
|
|
|
echo "Running build for $BUILD_TYPE"
|
|
|
|
npm run build:$BUILD_TYPE
|
2024-03-04 21:46:32 -05:00
|
|
|
echo "Built..."
|
|
|
|
tree -C ./server/project/build
|
2024-03-02 13:59:49 -05:00
|
|
|
|
2024-03-02 15:09:22 -05:00
|
|
|
- name: Archive Build
|
2024-03-02 15:11:26 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
2024-03-02 15:09:22 -05:00
|
|
|
with:
|
2024-03-02 15:25:43 -05:00
|
|
|
name: server-build
|
2024-03-02 15:09:22 -05:00
|
|
|
path: ./server/project/build/
|
|
|
|
overwrite: true
|
2024-03-02 22:29:09 -05:00
|
|
|
|
2024-03-02 22:46:27 -05:00
|
|
|
build-modules:
|
|
|
|
needs: check-tag-exists
|
|
|
|
if: needs.check-tag-exists.outputs.proceed == 'true'
|
2024-03-02 22:29:09 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2024-03-04 21:46:32 -05:00
|
|
|
image: refringe/spt-build-dotnet:0.0.6
|
2024-03-02 22:29:09 -05:00
|
|
|
steps:
|
|
|
|
- name: Clone
|
|
|
|
run: |
|
|
|
|
rm -rf ./modules
|
2024-03-04 21:09:03 -05:00
|
|
|
git clone https://dev.sp-tarkov.com/SPT-AKI/Modules.git --branch 3.8.0-BE-Test --depth 1 ./modules
|
2024-03-02 22:29:09 -05:00
|
|
|
|
2024-03-03 13:08:14 -05:00
|
|
|
- name: Fetch Server Core Config
|
|
|
|
run: |
|
2024-03-03 13:44:32 -05:00
|
|
|
rm -rf ./server-core
|
2024-03-03 13:08:14 -05:00
|
|
|
git init ./server-core
|
|
|
|
cd ./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
|
2024-03-04 21:09:03 -05:00
|
|
|
git fetch --depth=1 origin 3.8.0-BE-Test
|
2024-03-03 13:08:14 -05:00
|
|
|
git checkout FETCH_HEAD
|
2024-03-03 18:29:54 -05:00
|
|
|
ls -la project/assets/configs
|
2024-03-03 13:08:14 -05:00
|
|
|
shell: bash
|
|
|
|
|
2024-03-03 13:21:07 -05:00
|
|
|
- name: Extract Client Version
|
2024-03-03 18:37:06 -05:00
|
|
|
id: extract-client-version
|
2024-03-03 13:21:07 -05:00
|
|
|
run: |
|
|
|
|
cd ./server-core/project/assets/configs
|
2024-03-03 18:29:54 -05:00
|
|
|
FULL_VERSION=$(jq -r '.compatibleTarkovVersion' core.json)
|
|
|
|
CLIENT_VERSION=${FULL_VERSION##*.}
|
2024-03-03 16:41:12 -05:00
|
|
|
echo "Extracted Client Version: $CLIENT_VERSION"
|
|
|
|
echo "::set-output name=client_version::$CLIENT_VERSION"
|
2024-03-03 13:21:07 -05:00
|
|
|
shell: bash
|
|
|
|
|
2024-03-03 18:29:54 -05:00
|
|
|
- name: Download Client Module Package
|
|
|
|
run: |
|
|
|
|
DIR_MANAGED="./modules/project/Shared/Managed"
|
2024-03-03 18:37:06 -05:00
|
|
|
DOWNLOAD_PATH="$DIR_MANAGED/${{ steps.extract-client-version.outputs.client_version }}.zip"
|
|
|
|
DOWNLOAD_URL="$MODULE_DOMAIN/${{ steps.extract-client-version.outputs.client_version }}.zip"
|
2024-03-03 18:29:54 -05:00
|
|
|
echo "Downloading Client Module Package from $DOWNLOAD_URL to $DOWNLOAD_PATH"
|
|
|
|
mkdir -p "$DIR_MANAGED"
|
2024-03-03 18:37:06 -05:00
|
|
|
wget -q -O "$DOWNLOAD_PATH" "$DOWNLOAD_URL" || {
|
2024-03-03 18:29:54 -05:00
|
|
|
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 }}
|
|
|
|
|
2024-03-03 18:44:40 -05:00
|
|
|
- name: Decompress Client Module Package
|
|
|
|
run: |
|
|
|
|
cd ./modules/project/Shared/Managed
|
|
|
|
7z x ${{ steps.extract-client-version.outputs.client_version }}.zip -aoa
|
2024-03-04 21:09:03 -05:00
|
|
|
echo "Client module package decompressed."
|
2024-03-03 18:44:40 -05:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Delete Client Module Package
|
|
|
|
run: |
|
|
|
|
cd ./modules/project/Shared/Managed
|
|
|
|
rm -f ${{ steps.extract-client-version.outputs.client_version }}.zip
|
|
|
|
echo "Client module package deleted."
|
|
|
|
shell: bash
|
|
|
|
|
2024-03-03 18:50:55 -05:00
|
|
|
- name: Build Modules
|
|
|
|
run: |
|
|
|
|
cd ./modules/project
|
|
|
|
dotnet build
|
2024-03-04 21:46:32 -05:00
|
|
|
echo "Built..."
|
|
|
|
tree -C ./modules/project/Build
|
2024-03-03 18:50:55 -05:00
|
|
|
shell: bash
|
|
|
|
|
2024-03-04 21:12:10 -05:00
|
|
|
- name: Archive Build
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: modules-build
|
|
|
|
path: ./modules/project/Build
|
|
|
|
overwrite: true
|
|
|
|
|
2024-03-02 22:46:27 -05:00
|
|
|
build-launcher:
|
|
|
|
needs: check-tag-exists
|
|
|
|
if: needs.check-tag-exists.outputs.proceed == 'true'
|
2024-03-02 22:29:09 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2024-03-04 21:46:32 -05:00
|
|
|
image: refringe/spt-build-dotnet:0.0.6
|
2024-03-02 22:29:09 -05:00
|
|
|
steps:
|
|
|
|
- name: Clone
|
|
|
|
run: |
|
|
|
|
rm -rf ./launcher
|
2024-03-04 21:09:03 -05:00
|
|
|
git clone https://dev.sp-tarkov.com/SPT-AKI/Launcher.git --branch 3.8.0-BE-Test --depth 1 ./launcher
|