This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/.github/workflows/main.yml
2019-11-14 18:20:57 +01:00

46 lines
1.8 KiB
YAML

name: CD
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Run a multi-line script
run: |
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\"
.\MSBuild.exe $Env:GITHUB_WORKSPACE\UpTool2.sln -p:Configuration=Release -m
cd "C:\Program Files\7-Zip\"
.\7z a $Env:GITHUB_WORKSPACE\Release.zip $Env:GITHUB_WORKSPACE\UpTool2\bin\Release
cd $Env:GITHUB_WORKSPACE\UpTool2\bin\Release
$asmver = $([Reflection.Assembly]::Loadfile($(pwd).Path + "\\UpTool2.exe").GetName().version.ToString())
cd $Env:GITHUB_WORKSPACE
$xml = New-Object XML
$xml.load("Meta.xml")
$xml.meta.Hash = $(Get-FileHash .\Release.zip).Hash
$xml.meta.Version = $asmver
$xml.meta.File = "https://github.com/CreepyCrafter24/UpTool2/raw/master/Release.zip"
$xml.save("Meta.xml")
# Some copy/pasted code to remove the UTF-8 BOM
$FilePath=$(pwd).Path + "\Meta.xml"
[System.IO.FileInfo] $file = Get-Item -Path $FilePath
$sequenceBOM = New-Object System.Byte[] 3
$reader = $file.OpenRead()
$bytesRead = $reader.Read($sequenceBOM, 0, 3)
$reader.Dispose()
if ($bytesRead -eq 3 -and $sequenceBOM[0] -eq 239 -and $sequenceBOM[1] -eq 187 -and $sequenceBOM[2] -eq 191)
{
$utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False)
[System.IO.File]::WriteAllLines($FilePath, (Get-Content $FilePath), $utf8NoBomEncoding)
Write-Host "Remove UTF-8 BOM successfully"
}
- uses: matheusalbino/git-commit@v1.0.1
with:
user-name: Equal
user-email: equal@example.com
message: This a commit from Github Actions
github-token: ${{ secrets.GITHUB_TOKEN }}