From 295f6b0dbeaaa9dc9f88486d2750c3287fdbad74 Mon Sep 17 00:00:00 2001 From: Lateralus138 Date: Tue, 12 Sep 2023 23:43:20 -0500 Subject: [PATCH] Working on the build workflow, possible first build and pre-release - 09/13/2023 04:43:19 UTC --- .github/workflows/main_build.yml | 174 +++++++++++++++---------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/.github/workflows/main_build.yml b/.github/workflows/main_build.yml index 88fafbf..26ae2ef 100644 --- a/.github/workflows/main_build.yml +++ b/.github/workflows/main_build.yml @@ -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/setup-msbuild@v1.3.1 - - 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 'Lateralus138@users.noreply.github.com' - 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 }} \ No newline at end of file +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/setup-msbuild@v1.3.1 + - 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 'Lateralus138@users.noreply.github.com' + 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 }}