diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b3509f4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,78 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + strategy: + matrix: + include: + # UART-CL Project + - os: windows-x64 + runtime: win-x64 + runner: windows-latest + project: "UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj" + app-name: "UART-CL" + display-name: "Windows - CLI" + - os: macos-arm64 + runtime: osx-arm64 + runner: macos-latest + project: "UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj" + app-name: "UART-CL" + display-name: "macOS ARM - CLI" + - os: macos-x64 + runtime: osx-x64 + runner: macos-latest + project: "UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj" + app-name: "UART-CL" + display-name: "macOS x64 - CLI" + - os: linux-x64 + runtime: linux-x64 + runner: ubuntu-latest + project: "UART-CL By TheCod3r/UART-CL By TheCod3r/UART-CL By TheCod3r.csproj" + app-name: "UART-CL" + display-name: "Linux - CLI" + # PS5 NOR Modifier Project (Windows only) + - os: windows-x64 + runtime: win-x64 + runner: windows-latest + project: "PS5 NOR Modifier/PS5 NOR Modifier.csproj" + app-name: "PS5-NOR-Modifier" + display-name: "Windows - App" + + runs-on: ${{ matrix.runner }} + name: ${{ matrix.display-name }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: dotnet restore "${{ matrix.project }}" -r ${{ matrix.runtime }} + + - name: Build + run: dotnet build "${{ matrix.project }}" --configuration Release --no-restore + + - name: Publish + run: dotnet publish "${{ matrix.project }}" --configuration Release --runtime ${{ matrix.runtime }} --self-contained true -p:PublishSingleFile=true --no-restore -o "${{ github.workspace }}/artifact-staging/${{ matrix.runtime }}" + + - name: Prepare unix artifacts for upload + if: runner.os == 'macOS' || runner.os == 'Linux' + run: | + cd ${{ github.workspace }}/artifact-staging/${{ matrix.runtime }} + tar -czf ${{ matrix.app-name }}-${{ matrix.runtime }}.tar.gz * + find . -not -name '${{ matrix.app-name }}-${{ matrix.runtime }}.tar.gz' -delete + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.app-name }}-${{ matrix.runtime }} + path: ${{ github.workspace }}/artifact-staging/${{ matrix.runtime }}/ \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7dd22a0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,123 @@ +name: Create Release + +on: + workflow_run: + workflows: ["Build"] + types: + - completed + branches: + - main + workflow_dispatch: + inputs: + workflow_run_id: + description: 'Workflow Run ID to use for artifacts' + required: true + type: string + +env: + MAJOR_VERSION: "1" + MINOR_VERSION: "3" + CURRENT_RELEASE: "1.2" + +jobs: + release: + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + pattern: "*" + path: artifacts + run-id: ${{ github.event.workflow_run.id || inputs.workflow_run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare app artifacts + run: | + cd artifacts + # Create zip for Windows app + cd PS5-NOR-Modifier-win-x64 + zip -r PS5-NOR-Modifier-win-x64.zip . + + - name: Calculate next version + id: version + run: | + # Get the base version + BASE_VERSION="${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}" + + # Fetch all tags + git fetch --tags + + # Get count of existing tags that match our base version + TAG_COUNT=$(git tag -l "v${BASE_VERSION}.*" | wc -l) + + # Use tag count as patch version + PATCH_VERSION="$TAG_COUNT" + + # Set the full version + FULL_VERSION="v${BASE_VERSION}.${PATCH_VERSION}" + echo "new_tag=${FULL_VERSION}" >> $GITHUB_OUTPUT + + # Generate changelog + # Get all version tags and sort them, excluding the current version and anything newer + PREV_TAG=$(git tag -l "v*.*.*" | sort -V | while read tag; do + # Only keep tags that are strictly less than our new version + if [ "$(echo -e "${FULL_VERSION}\n${tag}" | sort -V | head -n1)" = "${tag}" ] && [ "${tag}" != "${FULL_VERSION}" ]; then + echo "$tag" + fi + done | tail -n1 || echo "") + + if [ -z "$PREV_TAG" ]; then + # If no previous tag, use all commits + CHANGELOG=$(git log --pretty=format:"* %s" || echo "Initial release") + else + # Get commits since last tag + CHANGELOG=$(git log --pretty=format:"* %s" ${PREV_TAG}..HEAD || echo "No changes") + fi + { + echo "changelog<> "$GITHUB_OUTPUT" + + - name: Calculate version status + id: version_status + run: | + BASE_VERSION="${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}" + IS_PRERELEASE=$([ "$BASE_VERSION" != "${{ env.CURRENT_RELEASE }}" ] && echo "true" || echo "false") + echo "is_prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.version.outputs.new_tag }} + name: Release ${{ steps.version.outputs.new_tag }} + body: ${{ steps.version.outputs.changelog }} + files: | + artifacts/**/*.tar.gz + artifacts/**/*.zip + artifacts/UART-CL-win-x64/UART-CL By TheCod3r.exe + draft: ${{ steps.version_status.outputs.is_prerelease == 'false' }} + prerelease: ${{ steps.version_status.outputs.is_prerelease == 'true' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/PS5 NOR Modifier/PS5 NOR Modifier.csproj b/PS5 NOR Modifier/PS5 NOR Modifier.csproj index 811a503..9423262 100644 --- a/PS5 NOR Modifier/PS5 NOR Modifier.csproj +++ b/PS5 NOR Modifier/PS5 NOR Modifier.csproj @@ -8,9 +8,9 @@ true enable HardwareChip.ico - x86 + AnyCPU PS5 NOR Modifier - AnyCPU;x86 + AnyCPU;x86;x64 @@ -21,6 +21,10 @@ none + + none + + none @@ -29,6 +33,10 @@ none + + none + + diff --git a/docs/allow_macos.jpg b/docs/allow_macos.jpg new file mode 100644 index 0000000..da90a4f Binary files /dev/null and b/docs/allow_macos.jpg differ