Skip to content

Merge pull request #836 from storybuilder-org/PackageUpdates #671

Merge pull request #836 from storybuilder-org/PackageUpdates

Merge pull request #836 from storybuilder-org/PackageUpdates #671

Workflow file for this run

#IMPORTANT - Don't forget to bump the .NET Version for Install .NET AND StoryCADTests
name: AutoBuild
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
configuration: [Release, Debug]
platform: [x64, x86, arm64]
runs-on: windows-latest
env:
Solution_Name: StoryCAD.sln
steps:
- name: Download Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install .NET
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
#Install MSBUILD
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- uses: oprypin/[email protected]
with:
repository: storybuilder-org/StoryCAD
releases-only: true
id: testtag
#Bump version number
- name: Increase Version Number
run: |
$VersionRegex = "\d+\.\d+\.\d+\.\d+"
$LastVer = "${{ steps.testtag.outputs.tag }}"
$VersionSplit = $LastVer.Split(".")
$BUILD_BUILDNUMBER = $VersionSplit[0] + "." + $VersionSplit[1] + ".${{ github.run_number }}.65535"
$ManifestVersionRegex = " Version=""\d+\.\d+\.\d+\.\d+"""
$ScriptPath = $null
try
{
$ScriptPath = (Get-Variable MyInvocation).Value.MyCommand.Path
$ScriptDir = Split-Path -Parent $ScriptPath
}
catch {}
# Get and validate the version data
$VersionData = [regex]::matches($BUILD_BUILDNUMBER,$VersionRegex)
$NewVersion = $VersionData[0]
Write-Verbose "Version: $NewVersion"
$AssemblyVersion = $NewVersion
$ManifestVersion = " Version=""$NewVersion"""
$filecontent = Get-Content("D:\a\StoryCAD\StoryCAD\StoryCAD\Package.appxmanifest")
attrib $file -r
$filecontent -replace $ManifestVersionRegex, $ManifestVersion | Out-File "D:\a\StoryCAD\StoryCAD\StoryCAD\Package.appxmanifest" utf8
# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}")
$certificatePath = "GitHubActionsWorkflow.pfx"
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
[IO.File]::WriteAllText("D:\a\StoryCAD\StoryCAD\StoryCAD\.env", "${{ secrets.ENV }}")
[IO.File]::WriteAllText("D:\a\StoryCAD\StoryCAD\StoryCADTests\.env", "${{ secrets.ENV }}")
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}
- name: Restore and Build StoryCADTests
run: msbuild StoryCADTests\StoryCADTests.csproj /t:Build /p:Configuration=Debug /p:Platform=x64
- name: Setup VSTest.console.exe
uses: darenm/[email protected]
- name: Run StoryCADTests
run: vstest.console.exe D:\a\StoryCAD\StoryCAD\StoryCADTests\bin\x64\Debug\net8.0-windows10.0.19041.0\StoryCADTests.dll /Logger:Console /Platform:x64 /Framework:.NETCoreApp,Version=v7.0
# Create the app package by building and packaging the project
- name: Create the MSIX
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile="D:\a\StoryCAD\StoryCAD\GitHubActionsWorkflow.pfx" /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
env:
Appx_Bundle: Never
Appx_Package_Build_Mode: SideloadOnly
Appx_Package_Dir: Packages\
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}
# Remove the pfx
- name: Remove the pfx
run: |
Remove-Item -path GitHubActionsWorkflow.pfx
#Cleans output and file names
- name: Run MSIX Cleaner
run: |
D:\a\StoryCAD\StoryCAD\.github\workflows\MSIX.ps1 -TargetDirectory "D:\a\StoryCAD\StoryCAD\StoryCAD\Packages"
shell: pwsh
- name: Write help file
run: |
$LastVer = "${{ steps.testtag.outputs.tag }}"
$VersionSplit = $LastVer.Split(".")
$BUILD_BUILDNUMBER = $VersionSplit[0] + "." + $VersionSplit[1] + ".${{ github.run_number }}.65535"
"Hello, Thank you for testing StoryCAD " + $VersionSplit[0] + "." + $VersionSplit[1] + ".${{ github.run_number }}.65535" + " Alpha
1) Open StoryCAD.cer, this should bring up the certificate import wizard
2) Press install certificate, and change store location to Local Machine, then press next
3) Change the option to Place All Certificates in the following store and click browse
4) Select Trusted People and press OK and then press finish
Now you will want to open the msix folder and select the configuration you want,
if you don't know what configuration to pick then we recommend StoryCAD Release x64.msix.
Changelogs aren't available for Alpha Builds." | Out-File -FilePath "D:\a\StoryCAD\StoryCAD\StoryCAD\Packages\Install Instructions.txt"
# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload MSIX package
uses: actions/upload-artifact@v4
with:
name: StoryCAD
path: StoryCAD/StoryCAD/StoryCAD/Packages/*
compression-level: 9
include-hidden-files: true