Skip to content

Commit 666f2d4

Browse files
committed
feat: Add .NET CI/publish workflows; fix getvar
Add GitHub Actions workflows: .github/workflows/dotnet-ci.yml to run restore/build/test on ubuntu/windows/mac using .NET 10, and .github/workflows/publish-aot.yml to publish AOT builds for multiple RIDs (win-x64, win-x86, linux-x64, osx-x64, osx-arm64), zip/upload artifacts and create a release via workflow_dispatch with a version input. Also modify FastbootCLI/Program.cs so the "getvar" command calls util.GetVar(args[0]) instead of writing to Console.Error, delegating output handling to the util method.
1 parent 522ecf6 commit 666f2d4

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

.github/workflows/dotnet-ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: .NET CI/CD
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
name: Build & Test on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '10.0.x'
24+
25+
- name: Restore dependencies
26+
run: dotnet restore
27+
28+
- name: Build
29+
run: dotnet build --no-restore -c Release
30+
31+
- name: Test
32+
run: dotnet test --no-build -c Release --verbosity normal

.github/workflows/publish-aot.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish AOT
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Publish version'
8+
required: true
9+
default: '1.0.0'
10+
11+
jobs:
12+
publish:
13+
name: Publish for ${{ matrix.os }} (${{ matrix.rid }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- os: windows-latest
19+
rid: win-x64
20+
ext: .exe
21+
- os: windows-latest
22+
rid: win-x86
23+
ext: .exe
24+
- os: ubuntu-latest
25+
rid: linux-x64
26+
ext: ""
27+
- os: macos-latest
28+
rid: osx-x64
29+
ext: ""
30+
- os: macos-latest
31+
rid: osx-arm64
32+
ext: ""
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Setup .NET
38+
uses: actions/setup-dotnet@v4
39+
with:
40+
dotnet-version: '10.0.x'
41+
42+
- name: Publish AOT
43+
run: |
44+
dotnet publish FastbootCLI/FastbootCLI.csproj -c Release -r ${{ matrix.rid }} -p:PublishAot=true -p:OptimizationPreference=Size -o ./publish/${{ matrix.rid }}
45+
46+
- name: Zip Artifacts
47+
shell: pwsh
48+
run: |
49+
$publishDir = "./publish/${{ matrix.rid }}"
50+
$zipPath = "fastboot-${{ matrix.rid }}.zip"
51+
Compress-Archive -Path "$publishDir\*" -DestinationPath $zipPath
52+
53+
- name: Upload Artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: fastboot-${{ matrix.rid }}
57+
path: fastboot-${{ matrix.rid }}.zip
58+
59+
release:
60+
needs: publish
61+
runs-on: ubuntu-latest
62+
if: github.event_name == 'workflow_dispatch'
63+
steps:
64+
- name: Download all artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
path: ./artifacts
68+
69+
- name: Create Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: v${{ github.event.inputs.version }}
73+
name: Release v${{ github.event.inputs.version }}
74+
files: ./artifacts/**/*.zip
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

FastbootCLI/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ string GetPartition(string baseName)
180180
case "getvar":
181181
if (args.Count == 0) throw new Exception("getvar requires a variable name");
182182
if (args[0] == "all") util.GetVarAll();
183-
else Console.Error.WriteLine(args[0] + ": " + util.GetVar(args[0]));
183+
else util.GetVar(args[0]);
184184
break;
185185

186186
case "reboot":

0 commit comments

Comments
 (0)