Skip to content

Bump deps/zlib from 0f51fb4 to 545f194 #265

Bump deps/zlib from 0f51fb4 to 545f194

Bump deps/zlib from 0f51fb4 to 545f194 #265

Workflow file for this run

name: Build
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
steps:
- name: Check out files
uses: actions/[email protected]
with:
submodules: true
fetch-depth: 0
# NOTE - If LFS ever starts getting used during builds, switch this to true!
lfs: false
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Generate project files
run: tools/premake5 vs2022 --no-check
- name: Set up problem matching
uses: ammaraskar/msvc-problem-matcher@master
- name: Build ${{matrix.configuration}}
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=x64 build/boiii-reimagined.sln
- name: Upload ${{matrix.configuration}} symbols
uses: actions/[email protected]
with:
name: ${{matrix.configuration}} symbols
path: |
build\bin\x64\${{ matrix.configuration }}\boiii-reimagined.pdb
- name: Upload ${{matrix.configuration}} binary
uses: actions/[email protected]
with:
name: ${{matrix.configuration}} binary
path: |
build\bin\x64\${{ matrix.configuration }}\boiii-reimagined.exe
- name: Upload ${{matrix.configuration}} ext
uses: actions/[email protected]
with:
name: ${{matrix.configuration}} ext
path: |
ext.dll
- name: Upload ${{matrix.configuration}} data artifacts
uses: actions/[email protected]
with:
name: ${{matrix.configuration}} data artifacts
path: |
data/*
deploy:
name: Deploy artifacts
needs: build
runs-on: ubuntu-latest
if: github.repository_owner == 'BiraruStudios'
steps:
- name: Download Debug symbols
uses: actions/[email protected]
with:
name: Debug symbols
path: debug
- name: Download Debug binaries
uses: actions/[email protected]
with:
name: Debug binary
path: debug
- name: Download Debug ext
uses: actions/[email protected]
with:
name: Debug ext
path: debug
- name: Download Debug data artifacts
uses: actions/[email protected]
with:
name: Debug data artifacts
path: debug/data
- name: Download Release symbols
uses: actions/[email protected]
with:
name: Release symbols
path: release
- name: Download Release binaries
uses: actions/[email protected]
with:
name: Release binary
path: release
- name: Download Release ext
uses: actions/[email protected]
with:
name: Release ext
path: release
- name: Download Release data artifacts
uses: actions/[email protected]
with:
name: Release data artifacts
path: release/data
- name: Make boiii-reimagined-server dir
run: |
mkdir -p boiii-reimagined-server/debug/boiii
mkdir -p boiii-reimagined-server/release/boiii
- name: Move stuff into boiii-reimagined-server dir
run: |
cp debug/ext.dll boiii-reimagined-server/debug/boiii
cp release/ext.dll boiii-reimagined-server/release/boiii
cp -r debug/data boiii-reimagined-server/debug/boiii
cp -r release/data boiii-reimagined-server/release/boiii
cp -r debug/boiii-reimagined.exe boiii-reimagined-server/debug/boiii
cp -r release/boiii-reimagined.exe boiii-reimagined-server/release/boiii
- name: Create boiii-reimagined.json for both configurations
run: |
process_files() {
local base_path=$1
local json_file=$2
local search_path=$3
echo '[' > "$json_file"
ext_file="$base_path/boiii/ext.dll"
ext_file_name="ext.dll"
ext_size=$(stat -c %s "$ext_file")
ext_hash=$(sha1sum "$ext_file" | cut -d' ' -f1)
echo "[\"$ext_file_name\", $ext_size, \"$ext_hash\"]," >> "$json_file"
boiii_file="$base_path/boiii/boiii-reimagined.exe"
boiii_size=$(stat -c %s "$boiii_file")
boiii_hash=$(sha1sum "$boiii_file" | cut -d' ' -f1)
echo "[\"boiii-reimagined.exe\", $boiii_size, \"$boiii_hash\"]," >> "$json_file"
find "$search_path" -type f | while read -r file; do
size=$(stat -c %s "$file")
hash=$(sha1sum "$file" | cut -d' ' -f1)
relative_path=$(echo "$file" | sed "s|$base_path/boiii/||")
echo "[\"$relative_path\", $size, \"$hash\"]," >> "$json_file"
done
sed -i '$ s/,$//' "$json_file"
echo ']' >> "$json_file"
}
process_files "boiii-reimagined-server/debug" "boiii-reimagined-server/debug/boiii.json" "boiii-reimagined-server/debug/boiii/data"
process_files "boiii-reimagined-server/release" "boiii-reimagined-server/release/boiii.json" "boiii-reimagined-server/release/boiii/data"
- name: Zip files
run: |
zip -r debug.zip debug/*
zip -r release.zip release/*
zip -r boiii-reimagined-server.zip boiii-reimagined-server/*
- name: Send Embed
run: |
FILE_NAMES=$(ls -1 *.exe *.zip 2>/dev/null || true)
FILE_TABLE=""
if [ -n "$FILE_NAMES" ]; then
FILE_TABLE="File Name | \n"
FILE_TABLE+="--- | --- \n"
for FILE in $FILE_NAMES; do
FILE_TABLE+="$FILE | \n"
done
else
FILE_TABLE="No files"
fi
TIMESTAMP=$(TZ=Asia/Karachi date --iso-8601=seconds)
ESCAPED_TIMESTAMP=$(echo "$TIMESTAMP" | sed 's/"/\\"/g')
COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c1-7)
BUILD_NUMBER="[Workflow Run:](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\`${{ github.sha }}\`\n[Commit:](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\`$COMMIT_HASH\`"
DESCRIPTION="$BUILD_NUMBER"
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
TRIGGER_TYPE="Manually Triggered: True\nPull Request: False\nCommit: False"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
TRIGGER_TYPE="Manually Triggered: False\nPull Request: True\nCommit: False"
else
TRIGGER_TYPE="Manually Triggered: False\nPull Request: False\nCommit: True"
fi
JSON_PAYLOAD="{
\"content\": \"\",
\"tts\": false,
\"embeds\": [
{
\"description\": \"$DESCRIPTION\",
\"fields\": [
{
\"name\": \"Files:\",
\"value\": \"\`\`\`$FILE_TABLE\`\`\`\"
},
{
\"id\": 370131057,
\"name\": \"Info:\",
\"value\": \"\`$TRIGGER_TYPE\`\"
}
],
\"title\": \"Build:\",
\"color\": 16777215,
\"footer\": {
\"text\": \"Biraru Studio's\"
},
\"timestamp\": \"$ESCAPED_TIMESTAMP\"
}
],
\"components\": [],
\"actions\": {},
\"username\": \"Builds\"
}"
curl -H "Content-Type: application/json" -X POST -d "$JSON_PAYLOAD" ${{ secrets.DISCORD_BUILDS_WEBHOOK }}
- name: Upload Debug ZIP
uses: sinshutu/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILDS_WEBHOOK }}
with:
args: debug.zip
- name: Upload Release ZIP
uses: sinshutu/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILDS_WEBHOOK }}
with:
args: release.zip
- name: Upload BOIII Server ZIP
uses: sinshutu/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILDS_WEBHOOK }}
with:
args: boiii-reimagined-server.zip
- name: Prepare cleanup
run: |
echo "" > debug.zip
echo "" > release.zip
echo "" > boiii-reimagined-server.zip
- name: Cleanup Debug symbols
uses: actions/[email protected]
with:
name: Debug symbols
retention-days: 1
path: |
debug/boiii-reimagined.pdb
overwrite: true
- name: Cleanup Debug binary
uses: actions/[email protected]
with:
name: Debug binary
retention-days: 1
path: |
debug/boiii-reimagined.exe
overwrite: true
- name: Cleanup Debug data artifacts
uses: actions/[email protected]
with:
name: Debug data artifacts
retention-days: 1
path: |
debug/data
overwrite: true
- name: Cleanup Debug ext
uses: actions/[email protected]
with:
name: Debug ext
retention-days: 1
path: |
debug/ext.dll
overwrite: true
- name: Cleanup Release symbols
uses: actions/[email protected]
with:
name: Release symbols
retention-days: 1
path: |
release/boiii-reimagined.pdb
overwrite: true
- name: Cleanup Release binary
uses: actions/[email protected]
with:
name: Release binary
retention-days: 1
path: |
release/boiii-reimagined.exe
overwrite: true
- name: Cleanup Release data artifacts
uses: actions/[email protected]
with:
name: Release data artifacts
retention-days: 1
path: |
release/data
overwrite: true
- name: Cleanup Release ext
uses: actions/[email protected]
with:
name: Release ext
retention-days: 1
path: |
release/ext.dll
overwrite: true