Skip to content

revert back to old scan code #49

revert back to old scan code

revert back to old scan code #49

name: .NET 8 Build
on:
push:
branches: [ Main ]
paths-ignore:
- '**.md'
- '**/ISSUE_TEMPLATE/**'
- '**.json'
- '.gitignore'
- '.gitattributes'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Get latest commit hash
id: get-hash
run: echo "::set-output name=hash::$(git rev-parse HEAD)"
- name: Replace ToolVersion with commit hash
run: |
$content = Get-Content -Path "${{github.workspace}}/XAU/ViewModels/Pages/HomeViewModel.cs" -Raw
$content = $content -replace 'public static string ToolVersion = "EmptyDevToolVersion";', 'public static string ToolVersion = "DEV-${{ steps.get-hash.outputs.hash }}";'
$content = $content -replace 'Tool Version: {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}', 'Tool Version: DEV-${{ steps.get-hash.outputs.hash }}'
Set-Content -Path "${{github.workspace}}/XAU/ViewModels/Pages/HomeViewModel.cs" -Value $content
- name: Restore dependencies
run: dotnet restore /p:EnableWindowsTargeting=true
- name: Build
run: dotnet publish XAU.sln -c Release -r win-x64 --self-contained false /p:PublishSingleFile=true /p:PublishReadyToRun=false /p:IncludeAllContentForSelfExtract=true /p:EnableWindowsTargeting=true -o ./publish
- name: Copy .exe file to temp
run: |
New-Item -ItemType Directory -Force -Path "${{github.workspace}}/../temp"
Copy-Item -Path "./publish/XAU.exe" -Destination "${{github.workspace}}/../temp/"
- name: Copy .exe file to workspace
run: |
Remove-Item -Path "${{github.workspace}}/XAU.exe" -ErrorAction Ignore
Move-Item -Path "${{github.workspace}}/../temp/XAU.exe" -Destination "${{github.workspace}}/XAU.exe"
- name: Write download URL and version to JSON file
run: |
echo "{ `"DownloadURL`": `"https://github.com/${{ github.repository }}/raw/Pre-Release/XAU.exe`", `"LatestBuildVersion`": `"${{ steps.get-hash.outputs.hash }}`" }" | Out-File -FilePath info.json
- name: Create and switch to new branch
run: |
git checkout --orphan Pre-Release
git rm -f --cached -r .
- name: Setup Git
run: |
git config --global user.email "38233332+ItsLogic@users.noreply.github.com"
git config --global user.name "Pre Release Action"
- name: Add files to new branch
run: |
git add XAU.exe info.json
git commit -m "Update pre-release version: $(date -u +'%Y-%m-%d %H:%M:%S')"
- name: Force Push to new branch
run: git push --force origin Pre-Release