Skip to content

Initial commit

Initial commit #1

Workflow file for this run

name: Build and Publish
on:
push:
branches:
- '*'
tags:
- '*'
paths:
- 'src/**'
- '.github/workflows/main.yml'
workflow_dispatch:
permissions:
id-token: write
attestations: write
contents: write
env:
OUTPUT_FILE_BASE_NAME: PS5-Exploit-Host-Self-Host-Tool
jobs:
build_and_release:
strategy:
matrix:
include:
- architecture: 'win-x64'
runner: 'windows-latest'
file_extension: '.exe'
- architecture: 'win-arm64'
runner: 'windows-latest'
file_extension: '.exe'
- architecture: 'linux-x64'
runner: 'ubuntu-20.04'
file_extension: ''
- architecture: 'linux-arm64'
runner: 'ubuntu-20.04'
file_extension: ''
- architecture: 'osx-arm64'
runner: 'macos-14'
file_extension: ''
- architecture: 'osx-x64'
runner: 'macos-13'
file_extension: ''
- architecture: 'framework-dependent-cross-platform'
runner: 'ubuntu-latest'
file_extension: '.zip'
- architecture: 'framework-dependent-windows' # we need a different target framework to get access to winrt for the wifi ap
runner: 'windows-latest'
file_extension: '.zip'
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Set env vars
run: |
# echo "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1" >> $GITHUB_ENV
echo "::remove-matcher owner=csc::" # remove matcher so warnings wont get passed to the actions summary
# - name: Compile inside Docker Container # for lower glibc target
# if: matrix.architecture == 'linux-arm64'
# run: |
# docker run --rm -v $(pwd):/workspace -w /workspace ubuntu:18.04 bash -c "
# apt-get update && apt-get install -y wget curl gnupg
# dpkg --add-architecture arm64
# echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted' > /etc/apt/sources.list.d/arm64.list
# echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted' >> /etc/apt/sources.list.d/arm64.list
# echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list.d/arm64.list
# sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
# sed -i -e 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list
# apt-get update
# apt-get install -y clang llvm binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu zlib1g-dev:arm64 openssl curl
# curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
# export DOTNET_ROOT=/root/.dotnet
# export PATH=\$DOTNET_ROOT:\$PATH
# /root/.dotnet/dotnet publish -r ${{ matrix.architecture }} --framework net8.0 -p:TargetFramework=net8.0 -p:ObjCopyName=aarch64-linux-gnu-objcopy -p:PublishAot=true -p:DebugType=None -p:DebugSymbols=false -p:StripSymbols=true -p:TrimmerRemoveSymbols=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:EventSourceSupport=false -p:InvariantGlobalization=true -p:StackTraceSupport=false -p:OptimizationPreference=Size -p:BuiltInComInteropSupport=false -p:CustomResourceTypesSupport=false -p:EnableCppCLIHostActivation=false -p:EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:IlcOptimizationPreference=Size -p:IlcGenerateStackTraceData=false -p:HttpActivityPropagationSupport=false -p:MetadataUpdaterSupport=false -p:PublishTrimmed=true -p:TrimMode=full -p:DynamicCodeSupport=false -p:RootAllApplicationAssemblies=false -p:IlcGenerateCompleteTypeMetadata=false -p:IlcDisableUnhandledExceptionExperience=false -p:IlcFoldIdenticalMethodBodies=true --configuration Release --output ./publish/${{ matrix.architecture }}
# "
- name: Install deps for linux cross arch compile
if: matrix.runner == 'ubuntu-20.04'
run: |
sudo dpkg --add-architecture arm64
sudo bash -c 'cat > /etc/apt/sources.list.d/arm64.list <<EOF
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted universe multiverse
EOF'
sudo sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
sudo sed -i -e 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang llvm binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu zlib1g-dev:arm64 openssl
- name: On windows use net8.0-windows10.0.17763.0 # none of the publish flags seem to be able to override the targetframework so modify the csproj
if: startsWith(matrix.runner, 'windows')
shell: pwsh
run: |
Get-ChildItem -Recurse -Filter *.csproj | ForEach-Object {
(Get-Content $_.FullName) -replace '<TargetFramework>.*</TargetFramework>', '<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>' | Set-Content $_.FullName
}
- name: Publish aot compiled
if: ${{ !contains(matrix.architecture, 'framework-dependent') }}
run: |
dotnet publish ./src -r ${{ matrix.architecture }} -p:PublishAot=true -p:DebugType=None -p:DebugSymbols=false -p:StripSymbols=true -p:TrimmerRemoveSymbols=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:EventSourceSupport=false -p:InvariantGlobalization=true -p:StackTraceSupport=false -p:OptimizationPreference=Size -p:BuiltInComInteropSupport=false -p:CustomResourceTypesSupport=false -p:EnableCppCLIHostActivation=false -p:EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:IlcOptimizationPreference=Size -p:IlcGenerateStackTraceData=false -p:HttpActivityPropagationSupport=false -p:MetadataUpdaterSupport=false -p:PublishTrimmed=true -p:TrimMode=full -p:DynamicCodeSupport=false -p:RootAllApplicationAssemblies=false -p:IlcGenerateCompleteTypeMetadata=false -p:IlcDisableUnhandledExceptionExperience=false -p:IlcFoldIdenticalMethodBodies=true --configuration Release --output ./publish/${{ matrix.architecture }}
- name: Publish framework-dependent
if: ${{ contains(matrix.architecture, 'framework-dependent') }}
shell: pwsh # there is no zip on windows but theres powershell on all runners
run: |
dotnet publish ./src -p:DebugType=None -p:DebugSymbols=false --configuration Release --output ./publish/${{ matrix.architecture }}
cd ./publish/${{ matrix.architecture }}
Compress-Archive -Path ./* -DestinationPath ${{ env.OUTPUT_FILE_BASE_NAME }}.zip
- name: Rename output file
run: mv ./publish/${{ matrix.architecture }}/${{ env.OUTPUT_FILE_BASE_NAME }}${{ matrix.file_extension }} ./publish/${{ matrix.architecture }}/${{ env.OUTPUT_FILE_BASE_NAME }}-${{ matrix.architecture }}${{ matrix.file_extension }}
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: ./publish/${{ matrix.architecture }}/${{ env.OUTPUT_FILE_BASE_NAME }}-${{ matrix.architecture }}${{ matrix.file_extension }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: publish-${{ matrix.architecture }}
path: ./publish/${{ matrix.architecture }}/${{ env.OUTPUT_FILE_BASE_NAME }}-${{ matrix.architecture }}${{ matrix.file_extension }}
- name: Create or Update GitHub Release
if: startsWith(github.ref, 'refs/tags/')
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
RELEASE_EXISTS=$(gh release view $TAG_NAME > /dev/null 2>&1; echo $?)
if [ $RELEASE_EXISTS -eq 0 ]; then
echo "Release $TAG_NAME already exists. Uploading assets..."
gh release upload $TAG_NAME ./publish/${{ matrix.architecture }}/${{ env.OUTPUT_FILE_BASE_NAME }}-${{ matrix.architecture }}${{ matrix.file_extension }}
else
echo "Creating new release $TAG_NAME..."
gh release create $TAG_NAME --verify-tag -d ./publish/${{ matrix.architecture }}/${{ env.OUTPUT_FILE_BASE_NAME }}-${{ matrix.architecture }}${{ matrix.file_extension }}
fi