-
Notifications
You must be signed in to change notification settings - Fork 88
108 lines (90 loc) · 3.38 KB
/
scriptsjson-generator.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 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