Update ci.yml #1081
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
- push # standard push on main or other branches | |
- workflow_dispatch # run manually via Github UI | |
- create # i.e. tags | |
jobs: | |
build: | |
name: Build TemplePlus | |
runs-on: windows-latest | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
release: ${{ steps.get_version.outputs.release }} | |
steps: | |
- id: get_version | |
name: Determine Version Number | |
run: | | |
"Building Ref: $($env:GITHUB_REF)" | |
if ($env:GITHUB_REF -notmatch "^refs/tags/v(\d+\.\d+(?:\.\d+)*(?:|-.*))$") { | |
"Tag name doesnt match release pattern. Building Snapshot Build." | |
$version = "0.2.$($env:GITHUB_RUN_NUMBER)" | |
$release = "false" | |
} else { | |
"Building Release Build" | |
$version = $Matches[1] | |
$release = "true" | |
} | |
"Version Number: $version" | |
"Release Build: $release" | |
# Make it available to the Github Workflow | |
Add-Content -Path $env:GITHUB_OUTPUT -Value "version=$version" | |
Add-Content -Path $env:GITHUB_OUTPUT -Value "release=$release" | |
shell: powershell | |
- uses: actions/checkout@v4 | |
- uses: nuget/setup-nuget@v1 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Download and Extract Dependencies | |
run: | | |
curl -L -o dependencies.7z https://github.com/GrognardsFromHell/Dependencies/releases/download/v1.19/dependencies.7z | |
7z x dependencies.7z | |
- name: Install NuGet packages | |
run: | | |
nuget install Squirrel.Windows -OutputDirectory Squirrel -Verbosity Detailed | |
nuget restore | |
- name: Build | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" | |
msbuild TemplePlus.sln /p:Configuration=Release /p:Platform=Win32 /p:MSBuildDefines="_TP_VERSION=%TEMPLEPLUS_VERSION%;_TP_COMMIT=%COMMIT_ID%;TP_RELEASE_BUILD" /verbosity:minimal | |
# Need to use cmd because of the vcvars32 batch file | |
shell: cmd | |
env: | |
TEMPLEPLUS_VERSION: ${{ steps.get_version.outputs.version }} | |
COMMIT_ID: ${GITHUB_SHA::8} | |
- name: Pack Release | |
run: .\PackRelease.ps1 | |
shell: powershell | |
env: | |
TEMPLEPLUS_VERSION: ${{ steps.get_version.outputs.version }} | |
- name: Pack Symbols | |
shell: cmd | |
# Package the symbol files, dump_syms needs the dev tools to be on the PATH | |
run: | | |
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\DIA SDK\bin | |
dependencies\bin\dump_syms.exe Release\TemplePlus.pdb > TemplePlus.sym | |
7z a TemplePlusSymbols-${{ steps.get_version.outputs.version }}.zip TemplePlus.sym Release\TemplePlus.pdb | |
- name: Pack Tools | |
shell: cmd | |
# Release Full with tools and all binaries | |
run: | | |
rd /s /q dist || cd . | |
mkdir dist | |
copy Release\*.exe dist | |
del dist\TemplePlus.exe | |
del dist\*Tests.exe | |
del dist\*.vshost.exe | |
copy Release\*.dll dist | |
copy dependencies\bin\*.dll dist | |
7z a TemplePlusTools-${{ steps.get_version.outputs.version }}.zip dist\* | |
- name: Upload ZIP-Distribution | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TemplePlus | |
path: TemplePlus-*.zip | |
- name: Upload PDB | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TemplePlusSymbols | |
path: TemplePlusSymbols-*.zip | |
- name: Upload Tools | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TemplePlusTools | |
path: TemplePlusTools-*.zip | |
- name: Upload Nuget Package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: TemplePlusNuget | |
path: TemplePlus*.nupkg | |
upload-release-symbols: | |
name: Upload Release Symbols | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ needs.build.outputs.release == 'true' }} | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: TemplePlusSymbols | |
- name: Uncompress Symbol Files | |
run: unzip TemplePlusSymbols*.zip | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::871006114897:role/templeplus-deploy-symbols | |
role-session-name: UploadTemplePlusSymbols | |
aws-region: eu-west-1 | |
- name: Upload Symbols to S3 | |
run: python -u deploy_symbols_s3.py TemplePlus.sym | |
package-release: | |
name: Package Release | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: TemplePlusNuget | |
- uses: nuget/setup-nuget@v1 | |
- name: Install Squirrel | |
run: nuget install Squirrel.Windows -OutputDirectory Squirrel -Verbosity Detailed | |
- name: Package Release | |
run: .\BuildRelease.ps1 | |
shell: powershell | |
env: | |
TEMPLEPLUS_VERSION: ${{ needs.build.outputs.version }} | |
- name: Upload Update-Site | |
uses: actions/upload-artifact@v4 | |
with: | |
name: UpdateSite | |
path: releases-packages/ | |
create-release: | |
name: Create Github Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- build | |
- package-release | |
if: ${{ needs.build.outputs.release == 'true' }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: artifacts | |
- name: Release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
name: "TemplePlus ${{ needs.build.outputs.version }}" | |
tag_name: v${{ needs.build.outputs.version }} | |
fail_on_unmatched_files: true | |
draft: true | |
files: | | |
artifacts/TemplePlus/* | |
artifacts/TemplePlusSymbols/* | |
artifacts/TemplePlusTools/* | |
artifacts/UpdateSite/* |