-
Notifications
You must be signed in to change notification settings - Fork 122
🚀 Cross-Platform CI/CD Pipeline #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
falconmick
wants to merge
2
commits into
TheCod3rYouTube:main
Choose a base branch
from
falconmick:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| 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 }}/ |
This file contains hidden or 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
| 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 "") | ||
|
|
||
| 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 "" | ||
| 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 }} | ||
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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