Skip to content

Merge branch 'Skua' of https://github.com/BrenoHenrike/Scripts into Skua #4002

Merge branch 'Skua' of https://github.com/BrenoHenrike/Scripts into Skua

Merge branch 'Skua' of https://github.com/BrenoHenrike/Scripts into Skua #4002

# name: Run Auto Generate JSON with C# File
# on:
# push:
# branches:
# - main
# - master
# - Skua
# - dev
# - 'feature/*'
# jobs:
# run-csharp-file:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: '6.0.x'
# - name: Run C# file
# run: dotnet run Program.cs --project SkuaScriptsGenerator/SkuaScriptsGenerator.csproj > scripts.json
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: scripts.json
# path: scripts.json
# - name: Commit and push changes
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# commit_message: 'Automatic commit by GitHub Actions'
# files: 'scripts.json'
# push: true
# push_options: '--force'
# - name: Delete artifact
# uses: geekyeggo/delete-artifact@v5
# with:
# name: scripts.json
# ================== Old Above ===============================
name: Run Auto Generate JSON with C# File
# === Workflow Trigger ===
on:
push:
branches:
- main
- master
- Skua
- dev
- 'feature/*'
# === Job Definition ===
jobs:
run-csharp-file:
runs-on: ubuntu-latest # The job will run on the latest version of Ubuntu
steps:
# === Step: Checkout Code ===
- name: Checkout code
uses: actions/checkout@v4 # Checks out the repository code
# === Step: Cache NuGet Packages ===
- name: Cache NuGet packages
uses: actions/cache@v4 # Caches NuGet packages to speed up builds
with:
path: ~/.nuget/packages # Path to the NuGet package cache
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.cs') }} # Cache key based on OS and project files
restore-keys: |
${{ runner.os }}-nuget- # Restore keys for cache
# === Step: Setup .NET ===
- name: Setup .NET
uses: actions/setup-dotnet@v4 # Sets up the .NET environment
with:
dotnet-version: '6.0.x' # Specifies the .NET version to use
# === Step: Build the Project ===
- name: Build the project
run: dotnet build --configuration Release SkuaScriptsGenerator/SkuaScriptsGenerator.csproj # Builds the project in Release mode
# === Step: Run C# File ===
- name: Run C# file
run: dotnet run --project SkuaScriptsGenerator/SkuaScriptsGenerator.csproj > scripts.json # Runs the C# program and outputs to scripts.json
# === Step: Upload Artifact ===
- name: Upload artifact
uses: actions/upload-artifact@v4 # Uploads the generated artifact
with:
name: scripts-${{ github.run_id }}.json # Names the artifact with the run ID for uniqueness
path: scripts.json # Path to the file to upload
retention-days: 30 # Keeps the artifact for 30 days
# === Step: Commit and Push Changes ===
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5 # Automatically commits changes
with:
commit_message: 'Automatic commit by GitHub Actions' # Commit message for the auto-commit
files: 'scripts.json' # Specifies the file to commit
push: true # Pushes the changes to the repository
push_options: '--force' # Force push to override remote changes