Extended the Pack command to support patching. #191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🛠️ .NET Desktop | |
on: | |
push: | |
paths-ignore: [HexEditorStructures/**, Images/**, Core/mbedTLS_AES/**, "README.md", "LICENSE", ".gitignore*", ".github/**/util_*"] | |
pull_request: | |
paths-ignore: [HexEditorStructures/**, Images/**, Core/mbedTLS_AES/**, "README.md", "LICENSE", ".gitignore*", ".github/**/util_*"] | |
# Stop the same workflow actions | |
concurrency: | |
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}} | |
cancel-in-progress: true | |
env: | |
ARTIFACT_PREFIX: GodotPCKExplorer | |
jobs: | |
get_version: | |
name: Get the current version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{steps.getversion.outputs.version}} | |
artifact_name: ${{steps.getversion.outputs.artifact_name}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
sparse-checkout: version.txt | |
- id: getversion | |
run: | | |
echo "Version: $(cat version.txt)" | |
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT | |
echo "Artifact name: ${{env.ARTIFACT_PREFIX}}_$(cat version.txt)" | |
echo "artifact_name=${{env.ARTIFACT_PREFIX}}_$(cat version.txt)" >> $GITHUB_OUTPUT | |
build_debug: | |
name: Build Framework | |
needs: get_version | |
strategy: | |
fail-fast: false | |
# For WinForms build | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup dotnet and cache | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
#cache: true | |
#cache-dependency-path: '**/packages.lock.json' | |
- name: Build Explorer | |
shell: bash | |
run: | | |
dotnet build Explorer/UI/GodotPCKExplorer.UI.csproj -c Debug -o bin/Explorer | |
dotnet build Explorer/UI/GodotPCKExplorer.UI.csproj -c Release -o bin/ExplorerRel | |
- name: Prepare artifacts | |
shell: powershell | |
run: | | |
Remove-Item bin/ExplorerRel/* -Recurse -Include *.exp,*.lib,*.pdb -Force | |
- name: Upload Debug artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_PREFIX}}_Debug | |
path: bin/Explorer | |
- name: Upload Release artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{needs.get_version.outputs.artifact_name}}_dotnet-ui-console-win-linux-mac | |
path: bin/ExplorerRel | |
- name: Build Bruteforcer | |
run: | | |
dotnet build Bruteforcer/UI/PCKBruteforcer.UI.csproj -o bin/Bruteforcer | |
publish_folder: | |
name: Publish Folder | |
needs: get_version | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup dotnet and cache | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Publish | |
shell: bash | |
run: | | |
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Win64 -o publish/Win64 | |
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Win86 -o publish/Win86 | |
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Linux64 -o publish/Linux64 | |
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=Mac64 -o publish/Mac64 | |
dotnet publish Explorer/Console/GodotPCKExplorer.Console.csproj -p:PublishProfile=MacArm -o publish/MacArm | |
- name: Prepare artifacts | |
shell: bash | |
run: | | |
find publish/ -type f \( -name "*.exp" -o -name "*.lib" -o -name "*.pdb" \) -exec rm -f {} + | |
cleanup_mbedtls() { | |
echo "mbedTLS cleanup is started in $1 for $2." | |
working_dir="$1" | |
keep_dir="$2" | |
base_dir="mbedTLS" | |
pushd "$working_dir" > /dev/null | |
if [ ! -d "$base_dir/$keep_dir" ]; then | |
echo "Folder '$keep_dir' not found in '$base_dir'." | |
return 1 | |
fi | |
for dir in "$base_dir"/*; do | |
if [ -d "$dir" ] && [ "$(basename "$dir")" != "$keep_dir" ]; then | |
echo "Removing: $dir" | |
rm -rf "$dir" | |
fi | |
done | |
popd > /dev/null | |
echo "mbedTLS cleanup is complete." | |
echo "" | |
} | |
cleanup_mbedtls "publish/Win64" "win_x64" | |
cleanup_mbedtls "publish/Win86" "win_x86" | |
cleanup_mbedtls "publish/Linux64" "linux_x64" | |
cleanup_mbedtls "publish/Mac64" "mac_universal" | |
cleanup_mbedtls "publish/MacArm" "mac_universal" | |
- name: Upload Win64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{needs.get_version.outputs.artifact_name}}_native-console-win-64 | |
path: publish/Win64 | |
- name: Upload Win86 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{needs.get_version.outputs.artifact_name}}_native-console-win-86 | |
path: publish/Win86 | |
- name: Upload Linux64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{needs.get_version.outputs.artifact_name}}_native-console-linux-64 | |
path: publish/Linux64 | |
- name: Upload Temp Mac64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: thin_mac_64 | |
path: publish/Mac64 | |
- name: Upload Temp MacArm | |
uses: actions/upload-artifact@v4 | |
with: | |
name: thin_mac_arm | |
path: publish/MacArm | |
fat_mac: | |
name: Fat macOS | |
needs: | |
- publish_folder | |
- get_version | |
strategy: | |
fail-fast: false | |
runs-on: macos-latest | |
steps: | |
- name: Download macOS Thin bins x64 | |
uses: actions/download-artifact@v4 | |
with: | |
path: publish/Mac64 | |
name: thin_mac_64 | |
- name: Download macOS Thin bins arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
path: publish/MacArm | |
name: thin_mac_arm | |
- name: Combine | |
shell: bash | |
run: | | |
mkdir publish/MacUniversal | |
bin_name="${{env.ARTIFACT_PREFIX}}.Console" | |
lipo -create -output publish/MacUniversal/$bin_name publish/Mac64/$bin_name publish/MacArm/$bin_name | |
file publish/MacUniversal/$bin_name | |
cp -rf publish/Mac64/mbedTLS publish/MacUniversal/mbedTLS | |
- name: Upload MacUniversal | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{needs.get_version.outputs.artifact_name}}_native-console-mac-universal | |
path: publish/MacUniversal | |
tests: | |
name: Tests | |
#needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup dotnet and cache | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Run unit tests | |
shell: bash | |
run: dotnet test Tests -p:Parallel=0 |