0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-12 17:10:45 -05:00

Replaces Mega action with custom commands to deal with the upload

Also includes a step that should remove BE and Debug versions that are older than 30 days.
This commit is contained in:
Refringe 2024-03-08 16:01:00 -05:00
parent 833abf8435
commit 258e4daef0
Signed by: Refringe
GPG Key ID: 7715B85B4A6306ED
2 changed files with 50 additions and 13 deletions

View File

@ -322,18 +322,42 @@ jobs:
echo "Release compressed as ${{ steps.generate-filename.outputs.filename }}."
shell: bash
- name: Upload Release
uses: Difegue/action-megacmd@master
with:
args: put -c "/workspace/refringe/Build/${{ steps.generate-filename.outputs.filename }}" "/spt-release/${{ steps.generate-filename.outputs.filename }}"
- name: Upload Mega Release
id: upload-mega
run: |
mega-https on
mega-login "${MEGA_EMAIL}" "${MEGA_PASSWORD}"
mega-put -c "/workspace/refringe/Build/${{ steps.generate-filename.outputs.filename }}" "/spt-release/${{ steps.generate-filename.outputs.filename }}"
mega-export -a "/spt-release/${{ steps.generate-filename.outputs.filename }}" -f
shell: bash
env:
USERNAME: ${{ secrets.MEGA_EMAIL }}
PASSWORD: ${{ secrets.MEGA_PASSWORD }}
- name: Generating Release Link
uses: Difegue/action-megacmd@master
with:
args: export -a "/spt-release/${{ steps.generate-filename.outputs.filename }}" -f
- name: Clean Old Mega Releases
run: |
mega-https on
mega-login "${{ secrets.MEGA_EMAIL }}" "${{ secrets.MEGA_PASSWORD }}"
# List files and filter out old DEBUG or BLEEDING files
mega-ls /spt-release | grep -E 'SPT-(DEBUG|BLEEDING).*\.7z$' | while read -r filename; do
# Extract date from filename
if [[ "$filename" =~ ([0-9]{8})\.7z$ ]]; then
file_date="${BASH_REMATCH[1]}"
file_date_fmt=$(date -d "${file_date:0:4}-${file_date:4:2}-${file_date:6:2}" +%s)
# Get current date minus 30 days
current_date=$(date +%s)
limit_date=$(date -d "@$((current_date - 30 * 24 * 3600))" +%s)
# Compare dates and delete old files
if [[ "$file_date_fmt" -lt "$limit_date" ]]; then
echo "Deleting old file: $filename"
mega-rm "/spt-release/$filename"
fi
fi
done
shell: bash
env:
USERNAME: ${{ secrets.MEGA_EMAIL }}
PASSWORD: ${{ secrets.MEGA_PASSWORD }}
MEGA_EMAIL: ${{ secrets.MEGA_EMAIL }}
MEGA_PASSWORD: ${{ secrets.MEGA_PASSWORD }}

View File

@ -1,13 +1,26 @@
# Use the Node v20.10.0 base image
FROM node:20.10.0
# Use the Node v20.10.0, Debian 12 base image
FROM node:20.10.0-bookworm
# Install necessary tools and dependencies
# - wget (for downloading MegaCMD)
# - git (duh)
# - git-lfs (duh)
# - zstd (caching action dependancy)
# - tree (pretty print build directory structure)
# - p7zip-full (the goat)
RUN apt-get update && \
apt-get install -y git git-lfs zstd tree p7zip-full && \
apt-get install -y wget git git-lfs zstd tree p7zip-full && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# - MegaCMD (for uploading to Mega.nz)
# - libc-ares2 (MegaCMD dependancy)
# - libmediainfo0v5 (MegaCMD dependancy)
# - libpcrecpp0v5 (MegaCMD dependancy)
# - libzen0v5 (MegaCMD dependancy)
RUN apt-get update && \
apt-get install -y libc-ares2 libmediainfo0v5 libpcrecpp0v5 libzen0v5 && \
wget https://mega.nz/linux/repo/Debian_12/amd64/megacmd-Debian_12_amd64.deb && \
dpkg -i megacmd-Debian_12_amd64.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*