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

46 lines
1.8 KiB
YAML
Raw Normal View History

2019-11-13 14:34:29 +01:00
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
2019-11-13 15:02:36 +01:00
cd "C:\Program Files\7-Zip\"
.\7z a $Env:GITHUB_WORKSPACE\Release.zip $Env:GITHUB_WORKSPACE\UpTool2\bin\Release
2019-11-14 18:01:31 +01:00
cd $Env:GITHUB_WORKSPACE\UpTool2\bin\Release
$asmver = $([Reflection.Assembly]::Loadfile($(pwd).Path + "\\UpTool2.exe").GetName().version.ToString())
2019-11-13 14:34:29 +01:00
cd $Env:GITHUB_WORKSPACE
2019-11-13 15:02:36 +01:00
$xml = New-Object XML
$xml.load("Meta.xml")
$xml.meta.Hash = $(Get-FileHash .\Release.zip).Hash
2019-11-14 18:01:31 +01:00
$xml.meta.Version = $asmver
2019-12-11 16:53:54 +01:00
$xml.meta.File = "https://github.com/JFronny/UpTool2/raw/master/Release.zip"
2019-11-13 15:02:36 +01:00
$xml.save("Meta.xml")
2019-11-14 18:19:24 +01:00
# 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"
}
2019-11-13 15:02:36 +01:00
- uses: matheusalbino/git-commit@v1.0.1
2019-11-13 14:34:29 +01:00
with:
2019-11-13 15:02:36 +01:00
user-name: Equal
user-email: equal@example.com
message: This a commit from Github Actions
github-token: ${{ secrets.GITHUB_TOKEN }}