0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-12 15:10:45 -05:00
- Nightly builds should happen at 3pm ET
- The Determine-Build-Type step happens earlier in the build process now & it's based on the passed tag instead of the current commits tag.
- Torrent files are only created for stable releases.
- Nightly builds are now cleaned from external sources
- External sources now delete nightly, debug, and bleeding releases older than 14 days.
- Updates node environment to v20.11.1
This commit is contained in:
Refringe 2024-03-14 17:27:16 -04:00
parent 4a809fb0fd
commit 547e8ac734
Signed by: Refringe
GPG Key ID: 7715B85B4A6306ED
4 changed files with 66 additions and 62 deletions

View File

@ -2,7 +2,7 @@ name: SPT Release Build
on: on:
schedule: schedule:
- cron: '* 19 * * *' # Every day at 7pm UTC (3pm ET) - cron: '* 13 * * *' # Every day at 3pm ET
push: push:
# main can be removed when actions are available in the sub-project repos # main can be removed when actions are available in the sub-project repos
branches: [ main, trigger ] branches: [ main, trigger ]
@ -11,7 +11,7 @@ jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: refringe/spt-build-node:1.0.5 image: refringe/spt-build-node:1.0.6
outputs: outputs:
proceed: ${{ steps.check-existence.outputs.proceed }} proceed: ${{ steps.check-existence.outputs.proceed }}
is_nightly: ${{ steps.determine-context.outputs.is_nightly }} is_nightly: ${{ steps.determine-context.outputs.is_nightly }}
@ -19,6 +19,7 @@ jobs:
branch_modules: ${{ steps.determine-context.outputs.branch_modules }} branch_modules: ${{ steps.determine-context.outputs.branch_modules }}
branch_launcher: ${{ steps.determine-context.outputs.branch_launcher }} branch_launcher: ${{ steps.determine-context.outputs.branch_launcher }}
target_tag: ${{ steps.determine-context.outputs.target_tag }} target_tag: ${{ steps.determine-context.outputs.target_tag }}
build_type: ${{ steps.determine-build-type.outputs.build_type }}
client_version: ${{ steps.versions.outputs.client_version }} client_version: ${{ steps.versions.outputs.client_version }}
spt_version: ${{ steps.versions.outputs.spt_version }} spt_version: ${{ steps.versions.outputs.spt_version }}
mod_enabled_bleeding: ${{ steps.mod-config.outputs.bleeding }} mod_enabled_bleeding: ${{ steps.mod-config.outputs.bleeding }}
@ -41,6 +42,28 @@ jobs:
fi fi
shell: bash shell: bash
- name: Determine Build Type
id: determine-build-type
run: |
if [[ "${{ steps.determine-context.outputs.is_nightly }}" == "true" ]]; then
# Nightly builds are always considered "bleeding"
BUILD_TYPE="bleeding"
else
TARGET_TAG="${{ steps.determine-context.outputs.target_tag }}"
# Debug build by default
# Bleeding builds have "-BE" in the target tag
# Release tags follow basic semantic versioning
BUILD_TYPE="debug"
if [[ "$TARGET_TAG" =~ -BE ]]; then
BUILD_TYPE="bleeding"
elif [[ "$TARGET_TAG" =~ ^(v?\d+\.\d+\.\d+)$ ]]; then
BUILD_TYPE="release"
fi
fi
echo "::set-output name=build_type::${BUILD_TYPE}"
shell: bash
- name: Check Existence - name: Check Existence
id: check-existence id: check-existence
run: | run: |
@ -158,9 +181,7 @@ jobs:
if: needs.prepare.outputs.proceed == 'true' if: needs.prepare.outputs.proceed == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: refringe/spt-build-node:1.0.5 image: refringe/spt-build-node:1.0.6
outputs:
build_type: ${{ steps.build-type.outputs.build_type }}
steps: steps:
- name: Clone - name: Clone
run: | run: |
@ -194,37 +215,6 @@ jobs:
echo "Last Commit Message:" && git log -1 --pretty=%B echo "Last Commit Message:" && git log -1 --pretty=%B
shell: bash shell: bash
- name: Determine Build Type
id: build-type
run: |
# Check if this is a nightly build
if [[ "${{ needs.prepare.outputs.is_nightly }}" == "true" ]]; then
# Nightly builds are always considered "bleeding"
BUILD_TYPE="bleeding"
else
cd /workspace/refringe/Build/server
# Prepare tags for check
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
# Debug build by default
# Bleeding builds have "-BE" in the tag
# Release tags follow basic semantic versioning
BUILD_TYPE="debug"
if [[ "$TAGS" =~ -BE ]]; then
BUILD_TYPE="bleeding"
elif [[ "$TAGS" =~ ^(v?\d+\.\d+\.\d+)$ ]]; then
BUILD_TYPE="release"
fi
fi
echo "::set-output name=build_type::${BUILD_TYPE}"
shell: bash
- name: Install Dependencies - name: Install Dependencies
run: | run: |
cd /workspace/refringe/Build/server/project cd /workspace/refringe/Build/server/project
@ -236,7 +226,7 @@ jobs:
- name: Build Server - name: Build Server
run: | run: |
cd /workspace/refringe/Build/server/project cd /workspace/refringe/Build/server/project
BUILD_TYPE="${{ steps.build-type.outputs.build_type }}" BUILD_TYPE="${{ needs.prepare.outputs.build_type }}"
echo "Running build for $BUILD_TYPE" echo "Running build for $BUILD_TYPE"
npm run build:$BUILD_TYPE -- --arch=x64 --platform=win32 npm run build:$BUILD_TYPE -- --arch=x64 --platform=win32
printf "\nBuilt!\n\n" printf "\nBuilt!\n\n"
@ -362,7 +352,7 @@ jobs:
needs: [prepare, build-server, build-modules, build-launcher] needs: [prepare, build-server, build-modules, build-launcher]
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: refringe/spt-build-node:1.0.5 image: refringe/spt-build-node:1.0.6
outputs: outputs:
base_name: ${{ steps.generate-filename.outputs.base_name }} base_name: ${{ steps.generate-filename.outputs.base_name }}
build_name: ${{ steps.generate-filename.outputs.build_name }} build_name: ${{ steps.generate-filename.outputs.build_name }}
@ -407,7 +397,7 @@ jobs:
- name: Generate Release Filename - name: Generate Release Filename
id: generate-filename id: generate-filename
run: | run: |
BUILD_TYPE=${{ needs.build-server.outputs.build_type }} BUILD_TYPE=${{ needs.prepare.outputs.build_type }}
SPT_VERSION=${{ needs.prepare.outputs.spt_version }} SPT_VERSION=${{ needs.prepare.outputs.spt_version }}
CLIENT_VERSION=${{ needs.prepare.outputs.client_version }} CLIENT_VERSION=${{ needs.prepare.outputs.client_version }}
TARGET_TAG=${{ needs.prepare.outputs.target_tag }} TARGET_TAG=${{ needs.prepare.outputs.target_tag }}
@ -458,7 +448,7 @@ jobs:
needs: [prepare, assemble-release, build-server] needs: [prepare, assemble-release, build-server]
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: refringe/spt-build-node:1.0.5 image: refringe/spt-build-node:1.0.6
steps: steps:
- name: Download Release Artifact - name: Download Release Artifact
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
@ -483,6 +473,7 @@ jobs:
shell: bash shell: bash
- name: Create Torrent File - name: Create Torrent File
if: needs.prepare.outputs.build_type == 'release'
id: torrent_create id: torrent_create
run: | run: |
BASE_NAME="${{ needs.assemble-release.outputs.base_name }}" BASE_NAME="${{ needs.assemble-release.outputs.base_name }}"
@ -501,6 +492,7 @@ jobs:
shell: bash shell: bash
- name: Upload Torrent to HTTPS Source - name: Upload Torrent to HTTPS Source
if: needs.prepare.outputs.build_type == 'release'
id: upload-https-torrent id: upload-https-torrent
run: | run: |
cd /workspace/refringe/Build/ cd /workspace/refringe/Build/
@ -525,21 +517,21 @@ jobs:
echo "$FILE_LIST" echo "$FILE_LIST"
# Filtering and processing the file list # Filtering and processing the file list
echo "$FILE_LIST" | tr ' ' '\n' | grep -E 'SPT-(DEBUG|BLEEDING).*\.(7z|torrent)$' | while read filename; do echo "$FILE_LIST" | tr ' ' '\n' | grep -E 'SPT-(NIGHTLY|DEBUG|BLEEDING).*\.(7z|torrent)$' | while read filename; do
echo "Processing file: $filename" echo "Processing file: $filename"
# Extract date from filename # Extract date from filename
if [[ "$filename" =~ ([0-9]{8})\.(7z|torrent)$ ]]; then if [[ "$filename" =~ ([0-9]{8})\.(7z|torrent)$ ]]; then
file_date="${BASH_REMATCH[1]}" file_date="${BASH_REMATCH[1]}"
file_date_fmt=$(date -d "${file_date:0:4}-${file_date:4:2}-${file_date:6:2}" +%s) file_date_fmt=$(date -d "${file_date:0:4}-${file_date:4:2}-${file_date:6:2}" +%s)
current_date=$(date +%s) current_date=$(date +%s)
limit_date=$(date -d "@$((current_date - 30 * 24 * 3600))" +%s) limit_date=$(date -d "@$((current_date - 14 * 24 * 3600))" +%s)
if [[ "$file_date_fmt" -lt "$limit_date" ]]; then if [[ "$file_date_fmt" -lt "$limit_date" ]]; then
echo "Marked for deletion: $filename" echo "Marked for deletion: $filename"
echo "rm \"/public/$filename\"" >> delete_commands.txt echo "rm \"/public/$filename\"" >> delete_commands.txt
fi
fi fi
fi
done done
# Check if there are files to delete and execute # Check if there are files to delete and execute
@ -572,16 +564,16 @@ jobs:
mega-https on mega-https on
mega-login "${{ secrets.MEGA_EMAIL }}" "${{ secrets.MEGA_PASSWORD }}" mega-login "${{ secrets.MEGA_EMAIL }}" "${{ secrets.MEGA_PASSWORD }}"
# List files and filter out old DEBUG or BLEEDING files # List files and filter out old NIGHTLY, DEBUG, or BLEEDING files
mega-ls /spt-release | grep -E 'SPT-(DEBUG|BLEEDING).*\.7z$' | while read -r filename; do mega-ls /spt-release | grep -E 'SPT-(NIGHTLY|DEBUG|BLEEDING).*\.7z$' | while read -r filename; do
# Extract date from filename # Extract date from filename
if [[ "$filename" =~ ([0-9]{8})\.7z$ ]]; then if [[ "$filename" =~ ([0-9]{8})\.7z$ ]]; then
file_date="${BASH_REMATCH[1]}" file_date="${BASH_REMATCH[1]}"
file_date_fmt=$(date -d "${file_date:0:4}-${file_date:4:2}-${file_date:6:2}" +%s) file_date_fmt=$(date -d "${file_date:0:4}-${file_date:4:2}-${file_date:6:2}" +%s)
# Get current date minus 30 days # Get current date minus 14 days
current_date=$(date +%s) current_date=$(date +%s)
limit_date=$(date -d "@$((current_date - 30 * 24 * 3600))" +%s) limit_date=$(date -d "@$((current_date - 14 * 24 * 3600))" +%s)
# Compare dates and delete old files # Compare dates and delete old files
if [[ "$file_date_fmt" -lt "$limit_date" ]]; then if [[ "$file_date_fmt" -lt "$limit_date" ]]; then
@ -600,7 +592,7 @@ jobs:
- name: Post Build Info to Discord - name: Post Build Info to Discord
env: env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
BUILD_TYPE: ${{ needs.build-server.outputs.build_type }} BUILD_TYPE: ${{ needs.prepare.outputs.build_type }}
BASE_NAME: ${{ needs.assemble-release.outputs.base_name }} BASE_NAME: ${{ needs.assemble-release.outputs.base_name }}
BUILD_NAME: ${{ needs.assemble-release.outputs.build_name }} BUILD_NAME: ${{ needs.assemble-release.outputs.build_name }}
LINK_MEGA: ${{ steps.upload-mega.outputs.link_mega }} LINK_MEGA: ${{ steps.upload-mega.outputs.link_mega }}
@ -611,7 +603,7 @@ jobs:
MODS_ENABLED_RELEASE: ${{ needs.prepare.outputs.mod_enabled_release }} MODS_ENABLED_RELEASE: ${{ needs.prepare.outputs.mod_enabled_release }}
run: | run: |
cd /workspace/refringe/Build/ cd /workspace/refringe/Build/
FOOTER_MESSAGES=("You look great today!" "Powered by coffee" "Did you remember to hydrate today?" "Have you tried turning it off and on again?" "In Chomp we trust" "Beep boop, I'm a bot" "Keep calm and commit your code" "May the source be with you" "Go to bed, Terk" "Please direct all support requests to Drakia" "Meaw") FOOTER_MESSAGES=("You look great today!" "Don't ban me, Phantom!" "Powered by coffee" "Did you remember to hydrate today?" "Have you tried turning it off and on again?" "In Chomp we trust" "Beep boop, I'm a bot" "Keep calm and commit your code" "May the source be with you" "Go to bed, Terk" "Please direct all support requests to Drakia" "Meaw")
FOOTER_MESSAGE="${FOOTER_MESSAGES[$RANDOM % ${#FOOTER_MESSAGES[@]}]}" FOOTER_MESSAGE="${FOOTER_MESSAGES[$RANDOM % ${#FOOTER_MESSAGES[@]}]}"
TIMESTAMP=$(date --iso-8601=seconds) TIMESTAMP=$(date --iso-8601=seconds)
FILE_SIZE_MB=$(stat -c %s "$BUILD_NAME" | awk '{printf "%.2f MB", $1 / 1024 / 1024}') FILE_SIZE_MB=$(stat -c %s "$BUILD_NAME" | awk '{printf "%.2f MB", $1 / 1024 / 1024}')
@ -641,7 +633,14 @@ jobs:
MODS="$MODS_ENABLED_RELEASE" MODS="$MODS_ENABLED_RELEASE"
fi fi
fi fi
EMBED_DESCRIPTION+=$'\n\n**Build Information:** 📊\n**Name**: *'"${BASE_NAME}"$'*\n**Mods Enabled**: *'"${MODS}"$'*\n**File Size**: *'"${FILE_SIZE_MB}"$'*\n**SHA-256 Hash**: *'"${FILE_HASH}"$'*\n\n**Primary Download Link:** 🚀\n'"${LINK_MEGA}"$'\n\n**Torrent Link:** 🔗\n'"${LINK_TORRENT}"$'\n\nIn order to conserve bandwidth, please consider using the *above* methods to download the release. If you have issues using those methods, you are free to download using any of the following HTTP mirrors.\n\nWhile the links *below* are not secret, **do not advertise them**. The primary MEGA link or torrent should be used to advertise any downloads.\n\n**Mirrors:** 🌐\n'"${LINK_HTTPS}"
# Build the dynamic part of the description
EMBED_DESCRIPTION+=$'\n\n🗂 **Build Information:** 🗂️\n**Name**: *'"${BASE_NAME}"$'*\n**Mods Enabled**: *'"${MODS}"$'*\n**File Size**: *'"${FILE_SIZE_MB}"$'*\n**SHA-256 Hash**: *'"${FILE_HASH}"$'*\n\n🚀 **Primary Download Link:** 🚀\n'"${LINK_MEGA}"$''
if [ -n "$LINK_TORRENT" ] && [ "$BUILD_TYPE" == "release" ]; then
# Conditionally add the torrent link for releases
EMBED_DESCRIPTION+=$'\n\n🔗 **Torrent Link:** 🔗\n'"${LINK_TORRENT}"$''
fi
EMBED_DESCRIPTION+=$'\n\nIn order to conserve bandwidth, please consider using the *above* methods to download the release. If you have issues using those methods, you are free to download using any of the following HTTP mirrors.\n\nWhile the links *below* are not secret, **do not advertise them**. The primary MEGA link or torrent should be used to advertise any downloads.\n\n🌐 **Mirrors:** 🌐\n'"${LINK_HTTPS}"
jq -n \ jq -n \
--arg EMBED_TITLE "$EMBED_TITLE" \ --arg EMBED_TITLE "$EMBED_TITLE" \

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"[markdown]": {
"editor.defaultFormatter": null
}
}

View File

@ -1,5 +1,5 @@
# Use the Node v20.10.0, Debian 12 base image # Use the Node v20.11.1, Debian 12 base image
FROM node:20.10.0-bookworm FROM node:20.11.1-bookworm
# Install necessary tools and dependencies # Install necessary tools and dependencies
# - wget (for downloading MegaCMD) # - wget (for downloading MegaCMD)

View File

@ -37,7 +37,7 @@ Be sure to update the version number to the next available version before buildi
``` ```
# Build and push the spt-build-node Docker image to the Docker Hub # Build and push the spt-build-node Docker image to the Docker Hub
docker build -t refringe/spt-build-node:1.0.6 -t refringe/spt-build-node:latest -f Dockerfile.node . docker build -t refringe/spt-build-node:1.0.7 -t refringe/spt-build-node:latest -f Dockerfile.node .
docker push refringe/spt-build-node --all-tags docker push refringe/spt-build-node --all-tags
# Build and push the spt-build-dotnet Docker image to the Docker Hub # Build and push the spt-build-dotnet Docker image to the Docker Hub