Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}/
123 changes: 123 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 "")
Comment on lines +70 to +75
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

takes all the version tags, sorts it, then filters out those greater than the tag we are pushing to and returns the first result back from that (which will be the previous release). "$(echo -e "${FULL_VERSION}\n${tag}" | sort -V | head -n1)" = "${tag}" specifically places the new version (FULL_VERSION) and then the tag we are testing is not greater than it on a new line, such that we can split it with a pipe, which we then sort, then if the head first line is equal to the tag we must have a tag that was greater thatn FULL_VERSION thus we skip it


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<<EOF"
echo "## What's Changed"
echo "${CHANGELOG}"
echo "## How to use"
echo "This section is still a WIP, I will update it once I am able to better test out the execution of the files we are generating."
echo "### Windows"
echo "After downloading the windows binary, you should just be able to run the executable and after allowing it to run, you should be able to use it."
echo "### MacOS"
echo "After downloading the macos binary, unblock the executable, see image bellow for how to find it. Just hit `Open Anyways` and follow prompts"
echo ""
echo "![MacOS Security Settings](docs/allow_macos.jpg)"
echo ""
echo "### Linux"
echo "Theoretically this works on all x86_64 linux distros, if you have any issues please let me know."
echo ""
echo "EOF"
} >> "$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 }}
12 changes: 10 additions & 2 deletions PS5 NOR Modifier/PS5 NOR Modifier.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>HardwareChip.ico</ApplicationIcon>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<Title>PS5 NOR Modifier</Title>
<Platforms>AnyCPU;x86</Platforms>
<Platforms>AnyCPU;x86;x64</Platforms>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -21,6 +21,10 @@
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
Expand All @@ -29,6 +33,10 @@
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<Content Include="HardwareChip.ico" />
</ItemGroup>
Expand Down
Binary file added docs/allow_macos.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.