ci: replace insecure workflow with dotnet build

This commit is contained in:
2025-12-09 17:03:01 -06:00
parent 673fa06d1e
commit 565b3d3b6d

View File

@@ -1,25 +1,50 @@
name: CI name: CI
on: [push, workflow_dispatch] on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-latest
runs-on: windows-latest
steps: steps:
- name: Download - name: Checkout
run: Invoke-WebRequest https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-windows-amd64.zip -OutFile ngrok.zip uses: actions/checkout@v4
- name: Extract
run: Expand-Archive ngrok.zip - name: Setup .NET
- name: Auth uses: actions/setup-dotnet@v4
run: .\ngrok\ngrok.exe authtoken $Env:NGROK_AUTH_TOKEN with:
env: dotnet-version: '8.0.x'
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
- name: Enable TS - name: Detect projects
run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0 id: detect
- run: Enable-NetFirewallRule -DisplayGroup "Remote Desktop" run: |
- run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1 PROJECTS=$(find . -name '*.csproj' -not -path './.git/*')
- run: Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "P@ssw0rd!" -Force) COUNT=$(printf '%s\n' "$PROJECTS" | grep -c . || true)
- name: Create Tunnel echo "count=$COUNT" >> "$GITHUB_OUTPUT"
run: .\ngrok\ngrok.exe tcp 3389 if [ "$COUNT" -gt 0 ]; then
echo "Found projects:" >> "$GITHUB_STEP_SUMMARY"
printf '%s\n' "$PROJECTS" >> "$GITHUB_STEP_SUMMARY"
else
echo "No .csproj files found" >> "$GITHUB_STEP_SUMMARY"
fi
- name: Restore
if: steps.detect.outputs.count != '0'
run: dotnet restore
- name: Build
if: steps.detect.outputs.count != '0'
run: dotnet build --no-restore --configuration Release
- name: Test
if: steps.detect.outputs.count != '0'
run: dotnet test --no-build --configuration Release --logger trx --results-directory TestResults
- name: No projects to build
if: steps.detect.outputs.count == '0'
run: echo "No .csproj found; nothing to build."