Skip to content

Commit

Permalink
Working on the build workflow, possible first build and pre-release -…
Browse files Browse the repository at this point in the history
… 09/13/2023 04:43:19 UTC
  • Loading branch information
Lateralus138 committed Sep 13, 2023
1 parent 90092b2 commit 295f6b0
Showing 1 changed file with 87 additions and 87 deletions.
174 changes: 87 additions & 87 deletions .github/workflows/main_build.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
name: Main Build
on:
push:
paths:
- '**.cpp'
- '**.h'
- '**.sln'
- '**.yml'
- '*.yml'
- '**.ps1'
env:
VS_PROGRAM: 1
VS_FILE: 0
VS_EPOCH:
VS_FULL:
RELEASE_TITLE: "Hosts Compress"
RELEASE_FILE: "./docs/md/pre-release.md"
BIN_DEFAULT: "hostscompress"
PRERELEASE: True
jobs:
build_windows:
name: Build Windows Project
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: microsoft/[email protected]
- id: make_hosts_compress
run: |
cd scripts
./build.ps1
if ($LASTEXITCODE -gt 0)
{
Write-Host "[$LASTEXITCODE] - Error in build script."
Exit $LASTEXITCODE
}
cd ../
$epoch = [decimal] [datetimeoffset]::UtcNow.ToUnixTimeMilliseconds()
echo "VS_FULL=${{ env.VS_PROGRAM }}.${{ env.VS_FILE }}.$epoch" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
$hostscompress_x86_md5_text = @'
{
"schemaVersion": 1,
"color": "2E9778",
"label": "hostscompress-x86.exe MD5",
"message": "PLACEHOLDER",
"labelColor": "1d1d1d",
"style": "for-the-badge",
"namedLogo": "windows"
}
'@
New-Item -ItemType Directory -Force -Path '.\docs\json'
Write-Output "$hostscompress_x86_md5_text" > .\docs\json\hostscompress_x86_md5.json
$file = ".\docs\json\hostscompress_x86_md5.json"
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$(Get-FileHash -Path "build\windows\x86\hostscompress-x86.exe" -Algorithm MD5).Hash
$hash = $(Get-FileHash -Path "build\windows\x86\hostscompress-x86.exe" -Algorithm MD5).Hash
((Get-Content -path $file -Raw) -replace 'PLACEHOLDER',$hash) | Set-Content -Path "$file"
$hostscompress_x64_md5_text = @'
{
"schemaVersion": 1,
"color": "2E9778",
"label": "hostscompress-x64.exe MD5",
"message": "PLACEHOLDER",
"labelColor": "1d1d1d",
"style": "for-the-badge",
"namedLogo": "windows"
}
'@
Write-Output "$hostscompress_x64_md5_text" > .\docs\json\hostscompress_x64_md5.json
$file = ".\docs\json\hostscompress_x64_md5.json"
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$hash = $(Get-FileHash -Path "build\windows\x64\hostscompress-x64.exe" -Algorithm MD5).Hash
((Get-Content -path $file -Raw) -replace 'PLACEHOLDER',$hash) | Set-Content -Path "$file"
git add .\docs\json\*
git config --global user.name 'Lateralus138'
git config --global user.email '[email protected]'
git commit --allow-empty -am "Pushed .\docs\json\* to master. - $(Get-Date ([datetime]::UtcNow)) UTC"
git push --force origin master
- uses: ncipollo/release-action@v1
if: steps.make_hosts_compress.conclusion == 'success'
with:
allowUpdates: True
tag: ${{ env.VS_FULL }}
name: ${{ env.RELEASE_TITLE }} - v${{ env.VS_FULL }}
bodyFile: ${{ env.RELEASE_FILE }}
prerelease: ${{ env.PRERELEASE }}
artifacts: build\windows\x86\${{ env.BIN_DEFAULT }}-x86.exe,build\windows\x64\${{ env.BIN_DEFAULT }}-x64.exe
token: ${{ secrets.GITHUB_TOKEN }}
name: Main Build
on:
push:
paths:
- '**.cpp'
- '**.h'
- '**.sln'
- '**.yml'
- '*.yml'
- '**.ps1'
env:
VS_PROGRAM: 1
VS_FILE: 0
VS_EPOCH:
VS_FULL:
RELEASE_TITLE: "Hosts Compress"
RELEASE_FILE: "./docs/md/pre-release.md"
BIN_DEFAULT: "hostscompress"
PRERELEASE: True
jobs:
build_windows:
name: Build Windows Project
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: microsoft/[email protected]
- id: make_hosts_compress
run: |
cd scripts
./build.ps1
if ($LASTEXITCODE -gt 0)
{
Write-Host "[$LASTEXITCODE] - Error in build script."
Exit $LASTEXITCODE
}
cd ../
$epoch = [decimal] [datetimeoffset]::UtcNow.ToUnixTimeMilliseconds()
echo "VS_FULL=${{ env.VS_PROGRAM }}.${{ env.VS_FILE }}.$epoch" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
$hostscompress_x86_md5_text = @'
{
"schemaVersion": 1,
"color": "2E9778",
"label": "hostscompress-x86.exe MD5",
"message": "PLACEHOLDER",
"labelColor": "1d1d1d",
"style": "for-the-badge",
"namedLogo": "windows"
}
'@
New-Item -ItemType Directory -Force -Path '.\docs\json'
Write-Output "$hostscompress_x86_md5_text" > .\docs\json\hostscompress_x86_md5.json
$file = ".\docs\json\hostscompress_x86_md5.json"
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$(Get-FileHash -Path "build\windows\x86\hostscompress-x86.exe" -Algorithm MD5).Hash
$hash = $(Get-FileHash -Path "build\windows\x86\hostscompress-x86.exe" -Algorithm MD5).Hash
((Get-Content -path $file -Raw) -replace 'PLACEHOLDER',$hash) | Set-Content -Path "$file"
$hostscompress_x64_md5_text = @'
{
"schemaVersion": 1,
"color": "2E9778",
"label": "hostscompress-x64.exe MD5",
"message": "PLACEHOLDER",
"labelColor": "1d1d1d",
"style": "for-the-badge",
"namedLogo": "windows"
}
'@
Write-Output "$hostscompress_x64_md5_text" > .\docs\json\hostscompress_x64_md5.json
$file = ".\docs\json\hostscompress_x64_md5.json"
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$hash = $(Get-FileHash -Path "build\windows\x64\hostscompress-x64.exe" -Algorithm MD5).Hash
((Get-Content -path $file -Raw) -replace 'PLACEHOLDER',$hash) | Set-Content -Path "$file"
git add .\docs\json\*
git config --global user.name 'Lateralus138'
git config --global user.email '[email protected]'
git commit --allow-empty -am "Pushed .\docs\json\* to master. - $(Get-Date ([datetime]::UtcNow)) UTC"
git push --force origin master
- uses: ncipollo/release-action@v1
if: steps.make_hosts_compress.conclusion == 'success'
with:
allowUpdates: True
tag: ${{ env.VS_FULL }}
name: ${{ env.RELEASE_TITLE }} - v${{ env.VS_FULL }}
bodyFile: ${{ env.RELEASE_FILE }}
prerelease: ${{ env.PRERELEASE }}
artifacts: build\windows\x86\${{ env.BIN_DEFAULT }}-x86.exe,build\windows\x64\${{ env.BIN_DEFAULT }}-x64.exe
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 295f6b0

Please sign in to comment.