diff --git a/.gitea/workflows/build.yaml b/.github/workflows/build.yaml similarity index 71% rename from .gitea/workflows/build.yaml rename to .github/workflows/build.yaml index cdfd556..8f0b2b5 100644 --- a/.gitea/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,9 +2,9 @@ name: SPT Release Build on: schedule: - - cron: "* 17 * * *" # Every day at 1pm ET - push: - branches: [trigger] + - cron: "0 17 * * *" + repository_dispatch: + types: [build-trigger] jobs: prepare: @@ -29,52 +29,48 @@ jobs: steps: - name: Determine Build Context id: determine-context + shell: bash + env: + EVENT_NAME: ${{ github.event_name }} + CLIENT_PAYLOAD_TAG: ${{ github.event.client_payload.tag }} run: | echo "Determining build context..." - if [[ "${{ github.event_name }}" == "schedule" ]]; then - echo "::set-output name=is_nightly::true" - echo "::set-output name=branch_server::3.10.0-DEV" - echo "::set-output name=branch_modules::310-dev" - echo "::set-output name=branch_launcher::3.10.0-DEV" + if [[ "$EVENT_NAME" == "schedule" ]]; then + echo "is_nightly=true" >> $GITHUB_OUTPUT + echo "branch_server=3.10.0-DEV" >> $GITHUB_OUTPUT + echo "branch_modules=310-dev" >> $GITHUB_OUTPUT + echo "branch_launcher=3.10.0-DEV" >> $GITHUB_OUTPUT else - echo "::set-output name=is_nightly::false" + echo "is_nightly=false" >> $GITHUB_OUTPUT + if [[ -z "$CLIENT_PAYLOAD_TAG" ]]; then + echo "No tag provided in event payload." + exit 1 + fi + echo "target_tag=$CLIENT_PAYLOAD_TAG" >> $GITHUB_OUTPUT fi - shell: bash - name: Determine Target Tag id: determine-target-tag if: steps.determine-context.outputs.is_nightly == 'false' - run: | - rm -rf /workspace/SPT/Build/trigger - if ! git clone https://${{ secrets.BUILD_USERNAME }}:${{ secrets.BUILD_ACCESS_TOKEN }}@dev.sp-tarkov.com/SPT/Build.git --branch "trigger" --depth 1 /workspace/SPT/Build/trigger; then - echo "Failed to clone the trigger branch. The branch may not exist." - echo "The trigger branch is critical to this workflow." - exit 1 - fi - cd /workspace/SPT/Build/trigger - if [ ! -f .gitea/trigger ]; then - echo "Failed to find the .gitea/trigger file. It may not exist." - echo "The trigger file is critical to this workflow." - exit 1 - fi - TAG_NAME=$(cat .gitea/trigger) - echo "::set-output name=target_tag::$TAG_NAME" shell: bash + run: | + TAG_NAME="${{ github.event.client_payload.tag }}" + if [[ -z "$TAG_NAME" ]]; then + echo "No tag provided in event payload." + exit 1 + fi + echo "target_tag=$TAG_NAME" >> $GITHUB_OUTPUT - name: Determine Build Type id: determine-build-type + shell: bash run: | if [[ "${{ steps.determine-context.outputs.is_nightly }}" == "true" ]]; then - # Nightly builds are currently considered a "bleedingmods" type build BUILD_TYPE="bleedingmods" else TARGET_TAG="${{ steps.determine-target-tag.outputs.target_tag }}" - TARGET_TAG_UPPER="${TARGET_TAG^^}" # Uppercase + TARGET_TAG_UPPER="${TARGET_TAG^^}" - # Debug build by default - # BleedingMods builds have "-BEM" in the target tag - # Bleeding builds have "-BE" in the target tag - # Release tags follow basic semantic versioning BUILD_TYPE="debug" if [[ "$TARGET_TAG_UPPER" =~ -BEM ]]; then BUILD_TYPE="bleedingmods" @@ -84,18 +80,18 @@ jobs: BUILD_TYPE="release" fi fi - echo "::set-output name=build_type::${BUILD_TYPE}" - shell: bash + echo "build_type=$BUILD_TYPE" >> $GITHUB_OUTPUT - name: Check Existence id: check-existence + shell: bash run: | PROCEED="true" if [[ "${{ steps.determine-context.outputs.is_nightly }}" == "true" ]]; then declare -A BRANCHES=( - [Server]="https://dev.sp-tarkov.com/SPT/Server.git@${{ steps.determine-context.outputs.branch_server }}" - [Modules]="https://dev.sp-tarkov.com/SPT/Modules.git@${{ steps.determine-context.outputs.branch_modules }}" - [Launcher]="https://dev.sp-tarkov.com/SPT/Launcher.git@${{ steps.determine-context.outputs.branch_launcher }}" + [Server]="https://github.com/sp-tarkov/server.git@${{ steps.determine-context.outputs.branch_server }}" + [Modules]="https://github.com/sp-tarkov/modules.git@${{ steps.determine-context.outputs.branch_modules }}" + [Launcher]="https://github.com/sp-tarkov/launcher.git@${{ steps.determine-context.outputs.branch_launcher }}" ) for REPO_NAME in "${!BRANCHES[@]}"; do REPO_URL="${BRANCHES[$REPO_NAME]%@*}" @@ -109,7 +105,7 @@ jobs: done else TAG="${{ steps.determine-target-tag.outputs.target_tag }}" - REPOS=("https://dev.sp-tarkov.com/SPT/Server.git" "https://dev.sp-tarkov.com/SPT/Modules.git" "https://dev.sp-tarkov.com/SPT/Launcher.git") + REPOS=("https://github.com/sp-tarkov/server.git" "https://github.com/sp-tarkov/modules.git" "https://github.com/sp-tarkov/launcher.git") for REPO in "${REPOS[@]}"; do echo "Checking for tag $TAG in $REPO..." if ! git ls-remote --tags $REPO $TAG | grep -q $TAG; then @@ -119,23 +115,22 @@ jobs: fi done fi - echo "::set-output name=proceed::${PROCEED}" - shell: bash + echo "proceed=$PROCEED" >> $GITHUB_OUTPUT - name: Tag Not Found if: steps.check-existence.outputs.proceed == 'false' run: | echo "Required branch/tag not found in one or more repositories, halting workflow." exit 1 - shell: bash - name: Extract Versions id: versions + shell: bash run: | rm -rf /workspace/SPT/Build/server-core git init /workspace/SPT/Build/server-core cd /workspace/SPT/Build/server-core - git remote add origin https://dev.sp-tarkov.com/SPT/Server.git + git remote add origin https://github.com/sp-tarkov/server.git git config core.sparseCheckout true echo "project/assets/configs/core.json" >> .git/info/sparse-checkout @@ -145,28 +140,25 @@ jobs: REF=${{ steps.determine-target-tag.outputs.target_tag }} fi - # Fetch and checkout the specific reference (branch or tag) git fetch --depth=1 origin "${REF}" git checkout FETCH_HEAD - ls -la project/assets/configs - # Extract versions from core.json cd project/assets/configs SPT_VERSION=$(jq -r '.sptVersion' core.json) FULL_VERSION=$(jq -r '.compatibleTarkovVersion' core.json) CLIENT_VERSION=${FULL_VERSION##*.} - echo "::set-output name=client_version::${CLIENT_VERSION}" - echo "::set-output name=spt_version::${SPT_VERSION}" - shell: bash + echo "client_version=$CLIENT_VERSION" >> $GITHUB_OUTPUT + echo "spt_version=$SPT_VERSION" >> $GITHUB_OUTPUT - name: Extract Mod Configurations id: mod-config + shell: bash run: | rm -rf /workspace/SPT/Build/server-mods-config git init /workspace/SPT/Build/server-mods-config cd /workspace/SPT/Build/server-mods-config - git remote add origin https://dev.sp-tarkov.com/SPT/Server.git + git remote add origin https://github.com/sp-tarkov/server.git git config core.sparseCheckout true echo "project/src/ide/BleedingEdgeEntry.ts" >> .git/info/sparse-checkout @@ -180,30 +172,25 @@ jobs: REF=${{ steps.determine-target-tag.outputs.target_tag }} fi - # Fetch and checkout the specific reference (branch or tag) git fetch --depth=1 origin "${REF}" git checkout FETCH_HEAD - ls -la project/src/ide - # Function to parse G_MODS_ENABLED value parse_mods_enabled() { grep 'G_MODS_ENABLED' $1 | sed -e 's/.*G_MODS_ENABLED\s*=\s*\(.*\);/\1/' } - # Extract the configuration options MODS_BLEEDING=$(parse_mods_enabled "project/src/ide/BleedingEdgeEntry.ts") MODS_BLEEDINGMODS=$(parse_mods_enabled "project/src/ide/BleedingEdgeModsEntry.ts") MODS_DEBUG=$(parse_mods_enabled "project/src/ide/DebugEntry.ts") MODS_RELEASE=$(parse_mods_enabled "project/src/ide/ReleaseEntry.ts") - echo "::set-output name=bleeding::${MODS_BLEEDING}" - echo "::set-output name=bleedingmods::${MODS_BLEEDINGMODS}" - echo "::set-output name=debug::${MODS_DEBUG}" - echo "::set-output name=release::${MODS_RELEASE}" - shell: bash + echo "bleeding=$MODS_BLEEDING" >> $GITHUB_OUTPUT + echo "bleedingmods=$MODS_BLEEDINGMODS" >> $GITHUB_OUTPUT + echo "debug=$MODS_DEBUG" >> $GITHUB_OUTPUT + echo "release=$MODS_RELEASE" >> $GITHUB_OUTPUT build-server: - needs: [prepare] + needs: prepare if: needs.prepare.outputs.proceed == 'true' runs-on: ubuntu-latest container: @@ -211,116 +198,87 @@ jobs: outputs: server_commit: ${{ steps.clone-server.outputs.server_commit }} steps: - - name: Clone + - name: Clone Server id: clone-server + shell: bash run: | rm -rf /workspace/SPT/Build/server if [[ "${{ needs.prepare.outputs.is_nightly }}" == "true" ]]; then BRANCH=${{ needs.prepare.outputs.branch_server }} echo "Cloning branch $BRANCH" - git clone https://dev.sp-tarkov.com/SPT/Server.git --branch "$BRANCH" --depth 1 /workspace/SPT/Build/server + git clone https://github.com/sp-tarkov/server.git --branch "$BRANCH" --depth 1 /workspace/SPT/Build/server else TAG=${{ needs.prepare.outputs.target_tag }} echo "Cloning tag $TAG" - git clone https://dev.sp-tarkov.com/SPT/Server.git --branch "$TAG" --depth 1 /workspace/SPT/Build/server + git clone https://github.com/sp-tarkov/server.git --branch "$TAG" --depth 1 /workspace/SPT/Build/server fi cd /workspace/SPT/Build/server - echo "::set-output name=server_commit::$(git rev-parse --short HEAD)" - shell: bash + echo "server_commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Pull LFS Files + shell: bash run: | cd /workspace/SPT/Build/server - git lfs pull && git lfs ls-files - shell: bash - - - name: Runner Debug Information - run: | - cd /workspace/SPT/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 - shell: bash - - - name: Cache NPM Dependencies - id: cache-npm-dependencies - uses: actions/cache@v4 - with: - path: | - /workspace/SPT/Build/server/project/node_modules - key: npm-dependencies-${{ hashFiles('/workspace/SPT/Build/server/project/package.json') }} + git lfs install --local + git lfs pull - name: Install Dependencies - if: steps.cache-npm-dependencies.outputs.cache-hit != 'true' + shell: bash run: | cd /workspace/SPT/Build/server/project - rm -rf node_modules npm install - shell: bash - - - name: Cache Server Build - id: cache-server-build - uses: actions/cache@v4 - with: - path: | - /workspace/SPT/Build/server/project/build - key: server-build-${{ steps.clone-server.outputs.server_commit }}-${{ needs.prepare.outputs.build_type }} - name: Build Server - if: steps.cache-server-build.outputs.cache-hit != 'true' + shell: bash run: | cd /workspace/SPT/Build/server/project BUILD_TYPE="${{ needs.prepare.outputs.build_type }}" echo "Running build for $BUILD_TYPE" npm run build:$BUILD_TYPE -- --arch=x64 --platform=win32 printf "\nBuilt!\n\n" - tree -C /workspace/SPT/Build/server/project/build - shell: bash - - name: Artifact Server - uses: actions/upload-artifact@v3 + - name: Upload Server Artifact + uses: actions/upload-artifact@v4 with: name: server-artifact path: /workspace/SPT/Build/server/project/build/ - compression-level: 0 retention-days: 1 - overwrite: true + if-no-files-found: error build-modules: - needs: [prepare] + needs: prepare if: needs.prepare.outputs.proceed == 'true' runs-on: ubuntu-latest container: image: refringe/spt-build-dotnet:1.0.0 steps: - - name: Clone + - name: Clone Modules id: clone-modules + shell: bash run: | rm -rf /workspace/SPT/Build/modules if [[ "${{ needs.prepare.outputs.is_nightly }}" == "true" ]]; then BRANCH=${{ needs.prepare.outputs.branch_modules }} echo "Cloning modules from branch $BRANCH" - git clone https://dev.sp-tarkov.com/SPT/Modules.git --branch "$BRANCH" --depth 1 /workspace/SPT/Build/modules + git clone https://github.com/sp-tarkov/modules.git --branch "$BRANCH" --depth 1 /workspace/SPT/Build/modules else TAG=${{ needs.prepare.outputs.target_tag }} echo "Cloning modules from tag $TAG" - git clone https://dev.sp-tarkov.com/SPT/Modules.git --branch "$TAG" --depth 1 /workspace/SPT/Build/modules + git clone https://github.com/sp-tarkov/modules.git --branch "$TAG" --depth 1 /workspace/SPT/Build/modules fi cd /workspace/SPT/Build/modules - echo "::set-output name=modules_commit::$(git rev-parse --short HEAD)" - shell: bash + echo "modules_commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Download Client Module Package + shell: bash + env: + MODULE_DOMAIN: ${{ secrets.MODULE_DOMAIN }} run: | DIR_MANAGED="/workspace/SPT/Build/modules/project/Shared/Managed" DOWNLOAD_PATH="$DIR_MANAGED/${{ needs.prepare.outputs.client_version }}.7z" - DOWNLOAD_URL="${{ secrets.MODULE_DOMAIN }}/${{ needs.prepare.outputs.client_version }}.7z" + DOWNLOAD_URL="${MODULE_DOMAIN}/${{ needs.prepare.outputs.client_version }}.7z" echo "Downloading Client Module Package from $DOWNLOAD_URL to $DOWNLOAD_PATH" mkdir -p "$DIR_MANAGED" wget -q -O "$DOWNLOAD_PATH" "$DOWNLOAD_URL" || { @@ -332,98 +290,75 @@ jobs: exit 1 fi echo "Download Successful: $DOWNLOAD_PATH" - shell: bash - name: Decompress Client Module Package + shell: bash run: | cd /workspace/SPT/Build/modules/project/Shared/Managed 7z x ${{ needs.prepare.outputs.client_version }}.7z -aoa echo "Client module package decompressed." - shell: bash - name: Delete Client Module Package + shell: bash run: | cd /workspace/SPT/Build/modules/project/Shared/Managed rm -f ${{ needs.prepare.outputs.client_version }}.7z echo "Client module package deleted." - shell: bash - - - name: Cache Modules Build - id: cache-modules-build - uses: actions/cache@v4 - with: - path: | - /workspace/SPT/Build/modules/project/Build - key: modules-build-${{ steps.clone-modules.outputs.modules_commit }} - name: Build Modules - if: steps.cache-modules-build.outputs.cache-hit != 'true' + shell: bash run: | cd /workspace/SPT/Build/modules/project dotnet build -c Release -p:Version=${{ needs.prepare.outputs.spt_version }} printf "\nBuilt!\n\n" - tree /workspace/SPT/Build/modules/project/Build - shell: bash - - name: Artifact Modules - uses: actions/upload-artifact@v3 + - name: Upload Modules Artifact + uses: actions/upload-artifact@v4 with: name: modules-artifact path: /workspace/SPT/Build/modules/project/Build - compression-level: 0 retention-days: 1 - overwrite: true + if-no-files-found: error build-launcher: - needs: [prepare] + needs: prepare if: needs.prepare.outputs.proceed == 'true' runs-on: ubuntu-latest container: image: refringe/spt-build-dotnet:1.0.0 steps: - - name: Clone + - name: Clone Launcher id: clone-launcher + shell: bash run: | rm -rf /workspace/SPT/Build/launcher if [[ "${{ needs.prepare.outputs.is_nightly }}" == "true" ]]; then BRANCH=${{ needs.prepare.outputs.branch_launcher }} echo "Cloning launcher from branch $BRANCH" - git clone https://dev.sp-tarkov.com/SPT/Launcher.git --branch "$BRANCH" --depth 1 /workspace/SPT/Build/launcher + git clone https://github.com/sp-tarkov/launcher.git --branch "$BRANCH" --depth 1 /workspace/SPT/Build/launcher else TAG=${{ needs.prepare.outputs.target_tag }} echo "Cloning launcher from tag $TAG" - git clone https://dev.sp-tarkov.com/SPT/Launcher.git --branch "$TAG" --depth 1 /workspace/SPT/Build/launcher + git clone https://github.com/sp-tarkov/launcher.git --branch "$TAG" --depth 1 /workspace/SPT/Build/launcher fi cd /workspace/SPT/Build/launcher - echo "::set-output name=launcher_commit::$(git rev-parse --short HEAD)" - shell: bash - - - name: Cache Launcher Build - id: cache-launcher-build - uses: actions/cache@v4 - with: - path: | - /workspace/SPT/Build/launcher/project/Build - key: launcher-build-${{ steps.clone-launcher.outputs.launcher_commit }} + echo "launcher_commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Build Launcher - if: steps.cache-launcher-build.outputs.cache-hit != 'true' + shell: bash run: | cd /workspace/SPT/Build/launcher/project dotnet build printf "\nBuilt!\n\n" - tree /workspace/SPT/Build/launcher/project/Build - shell: bash - - name: Artifact Launcher - uses: actions/upload-artifact@v3 + - name: Upload Launcher Artifact + uses: actions/upload-artifact@v4 with: name: launcher-artifact path: /workspace/SPT/Build/launcher/project/Build - compression-level: 0 retention-days: 1 - overwrite: true + if-no-files-found: error assemble-and-publish: needs: [prepare, build-server, build-modules, build-launcher] @@ -432,44 +367,45 @@ jobs: image: refringe/spt-build-node:1.0.9 steps: - name: Clean Directory + shell: bash run: | rm -rf /workspace/SPT/Build/release /workspace/SPT/Build/build mkdir -p /workspace/SPT/Build/release - shell: bash - name: Download Server Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: server-artifact path: /workspace/SPT/Build/release/ - name: Download Modules Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: modules-artifact path: /workspace/SPT/Build/release/ - name: Download Launcher Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: launcher-artifact path: /workspace/SPT/Build/release/ - name: Clone Build Project - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: /workspace/SPT/Build/build - name: Merge Static Assets and Dynamic Files - run: cp -rvf /workspace/SPT/Build/build/static-assets/* /workspace/SPT/Build/release/ shell: bash + run: cp -rvf /workspace/SPT/Build/build/static-assets/* /workspace/SPT/Build/release/ - name: List Release Contents - run: tree /workspace/SPT/Build/release shell: bash + run: tree /workspace/SPT/Build/release - name: Generate Release Filename id: generate-filename + shell: bash run: | BUILD_TYPE=${{ needs.prepare.outputs.build_type }} SPT_VERSION=${{ needs.prepare.outputs.spt_version }} @@ -478,19 +414,15 @@ jobs: TARGET_TAG=${{ needs.prepare.outputs.target_tag }} DATE=$(date +%Y%m%d) - # Conditionally format the BASE_NAME based on BUILD_TYPE and if it's a nightly build if [[ "${{ needs.prepare.outputs.is_nightly }}" == "true" ]]; then BASE_NAME="SPT-NIGHTLY-${SPT_VERSION}-${CLIENT_VERSION}-${SERVER_COMMIT}-${DATE}" else - # Make BUILD_TYPE and TARGET_TAG uppercase UPPER_BUILD_TYPE=$(echo "$BUILD_TYPE" | tr '[:lower:]' '[:upper:]') UPPER_TARGET_TAG=$(echo "$TARGET_TAG" | tr '[:lower:]' '[:upper:]') if [ "$BUILD_TYPE" = "release" ]; then BASE_NAME="SPT-${SPT_VERSION}-${CLIENT_VERSION}-${SERVER_COMMIT}" else - # For debug and non-nightly-bleeding builds, include either TAG_PART or DATE, but not both - # Determine TAG_PART based on TARGET_TAG structure TAG_PART="" if [[ "$UPPER_TARGET_TAG" == *-*-* ]]; then SUFFIX="${UPPER_TARGET_TAG##*-}" @@ -506,12 +438,12 @@ jobs: fi fi - echo "::set-output name=base_name::${BASE_NAME}" - echo "::set-output name=build_name::${BASE_NAME}.7z" - shell: bash + echo "base_name=$BASE_NAME" >> $GITHUB_OUTPUT + echo "build_name=${BASE_NAME}.7z" >> $GITHUB_OUTPUT - name: Compress Release id: compress-release + shell: bash run: | cd /workspace/SPT/Build/release 7z a -mx=9 -m0=lzma2 "../${{ steps.generate-filename.outputs.build_name }}" ./* @@ -520,9 +452,8 @@ jobs: FILE_SIZE_MB=$(stat -c %s "../${{ steps.generate-filename.outputs.build_name }}" | awk '{printf "%.2f MB", $1 / 1024 / 1024}') FILE_HASH=$(md5sum "../${{ steps.generate-filename.outputs.build_name }}" | awk '{print $1}' | xxd -r -p | base64) - echo "::set-output name=file_size_mb::${FILE_SIZE_MB}" - echo "::set-output name=file_hash::${FILE_HASH}" - shell: bash + echo "file_size_mb=$FILE_SIZE_MB" >> $GITHUB_OUTPUT + echo "file_hash=$FILE_HASH" >> $GITHUB_OUTPUT - name: R2 Upload if: needs.prepare.outputs.build_type == 'release' @@ -530,6 +461,12 @@ jobs: SPT_VERSION: ${{ needs.prepare.outputs.spt_version }} CLIENT_VERSION: ${{ needs.prepare.outputs.client_version }} FILE_HASH: ${{ steps.compress-release.outputs.file_hash }} + R2_ACCESS_KEY: ${{ secrets.R2_ACCESS_KEY }} + R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} + R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }} + R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }} + R2_FRONT: ${{ secrets.R2_FRONT }} + shell: bash run: | cd /workspace/SPT/Build @@ -537,51 +474,53 @@ jobs: echo '[r2] type = s3 provider = Cloudflare - access_key_id = ${{ secrets.R2_ACCESS_KEY }} - secret_access_key = ${{ secrets.R2_SECRET_ACCESS_KEY }} + access_key_id = '"$R2_ACCESS_KEY"' + secret_access_key = '"$R2_SECRET_ACCESS_KEY"' region = auto - endpoint = ${{ secrets.R2_ENDPOINT }} - acl = public-read' > /workspace/SPT/Build/rclone.conf + endpoint = '"$R2_ENDPOINT"' + acl = public-read' > ./rclone.conf # Generate Release JSON File echo "{ \"AkiVersion\": \"${SPT_VERSION}\", \"ClientVersion\": \"${CLIENT_VERSION}\", \"Mirrors\": [{ - \"DownloadUrl\": \"${{ secrets.R2_FRONT }}/${{ steps.generate-filename.outputs.build_name }}\", + \"DownloadUrl\": \"${R2_FRONT}/${{ steps.generate-filename.outputs.build_name }}\", \"Hash\": \"${FILE_HASH}\" }] - }" > /workspace/SPT/Build/release.json + }" > ./release.json echo "Current Local Directory:" ls -lah echo "Current Remote Directory:" - rclone ls r2:${{ secrets.R2_BUCKET_NAME }} --config /workspace/SPT/Build/rclone.conf + rclone ls r2:${R2_BUCKET_NAME} --config ./rclone.conf - # Remove old 7z files from the bucket - rclone lsf r2:${{ secrets.R2_BUCKET_NAME }} --config /workspace/SPT/Build/rclone.conf --files-only --include="*.7z" --absolute > files-to-remove.txt + # Remove old .7z files from the bucket + rclone lsf r2:${R2_BUCKET_NAME} --config ./rclone.conf --files-only --include="*.7z" --absolute > files-to-remove.txt echo "Files to be deleted:" cat files-to-remove.txt - rclone delete r2:${{ secrets.R2_BUCKET_NAME }} --config /workspace/SPT/Build/rclone.conf --files-from=files-to-remove.txt --max-depth=1 -vv + rclone delete r2:${R2_BUCKET_NAME} --config ./rclone.conf --files-from=files-to-remove.txt --max-depth=1 -vv - # Upload the file using rclone with the above config - rclone copy "/workspace/SPT/Build/${{ steps.generate-filename.outputs.build_name }}" r2:${{ secrets.R2_BUCKET_NAME }} --config /workspace/SPT/Build/rclone.conf -vv + # Upload the .7z file using rclone with the above config + rclone copy "./${{ steps.generate-filename.outputs.build_name }}" r2:${R2_BUCKET_NAME} --config ./rclone.conf -vv # Upload the JSON file using rclone with the above config - rclone copy "/workspace/SPT/Build/release.json" r2:${{ secrets.R2_BUCKET_NAME }} --config /workspace/SPT/Build/rclone.conf -vv - shell: bash + rclone copy "./release.json" r2:${R2_BUCKET_NAME} --config ./rclone.conf -vv + + echo "R2 Upload completed." - name: Upload Release to HTTPS Source id: upload-https-7z + shell: bash run: | cd /workspace/SPT/Build/ sshpass -p "${{ secrets.SFTP_PASSWORD }}" scp -v -o "Port=${{ secrets.SFTP_PORT }}" -o "ConnectTimeout=20" -o "StrictHostKeyChecking=no" "/workspace/SPT/Build/${{ steps.generate-filename.outputs.build_name }}" ${{ secrets.SFTP_USERNAME }}@${{ secrets.SFTP_HOST }}:/public/builds - echo "::set-output name=link_https::${{ secrets.SFTP_MIRROR_LINK }}/builds/${{ steps.generate-filename.outputs.build_name }}" - shell: bash + echo "link_https=${{ secrets.SFTP_MIRROR_LINK }}/builds/${{ steps.generate-filename.outputs.build_name }}" >> $GITHUB_OUTPUT - name: Upload Release to Mega id: upload-mega + shell: bash run: | mega-https on mega-login "${{ secrets.MEGA_EMAIL }}" "${{ secrets.MEGA_PASSWORD }}" @@ -592,12 +531,12 @@ jobs: # Generate link and save it. EXPORT_OUTPUT=$(mega-export -a "/spt-release/${{ steps.generate-filename.outputs.build_name }}" -f) LINK_MEGA=$(echo "$EXPORT_OUTPUT" | grep -o 'https://mega.nz/file/[A-Za-z0-9#_\-]*') - echo "::set-output name=link_mega::${LINK_MEGA}" + echo "link_mega=${LINK_MEGA}" >> $GITHUB_OUTPUT mega-logout - shell: bash - name: Clean Old Mega Releases + shell: bash run: | mega-https on mega-login "${{ secrets.MEGA_EMAIL }}" "${{ secrets.MEGA_PASSWORD }}" @@ -629,7 +568,6 @@ jobs: mega-deleteversions -f /spt-release/* mega-logout - shell: bash - name: Post Build Info to Discord env: @@ -645,6 +583,8 @@ jobs: MODS_ENABLED_BLEEDINGMODS: ${{ needs.prepare.outputs.mod_enabled_bleedingmods }} MODS_ENABLED_DEBUG: ${{ needs.prepare.outputs.mod_enabled_debug }} MODS_ENABLED_RELEASE: ${{ needs.prepare.outputs.mod_enabled_release }} + IS_NIGHTLY: ${{ needs.prepare.outputs.is_nightly }} + shell: bash run: | cd /workspace/SPT/Build/ UPPER_BUILD_TYPE=$(echo "$BUILD_TYPE" | tr '[:lower:]' '[:upper:]') @@ -724,4 +664,3 @@ jobs: --data-binary @payload_discord.json \ -v \ $DISCORD_WEBHOOK_URL - shell: bash