Skip to content

Commit 0c3a2e2

Browse files
committed
Build and release demo application
1 parent 8520b3d commit 0c3a2e2

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/release.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build and release demo
2+
3+
on:
4+
push
5+
6+
jobs:
7+
build:
8+
9+
runs-on: windows-latest
10+
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
16+
- name: Checkout
17+
uses: actions/checkout@v5
18+
19+
- name: Add msbuild to PATH
20+
uses: microsoft/setup-msbuild@v2
21+
with:
22+
msbuild-architecture: x64
23+
24+
- name: Build x86
25+
run: msbuild -restore -p:RestorePackagesConfig=true -p:Configuration=Release -p:Platform=x86 -clp:ForceConsoleColor -warnaserror ${{ github.workspace }}\Demo\Demo.slnx
26+
27+
- name: Build x64
28+
run: msbuild -restore -p:RestorePackagesConfig=true -p:Configuration=Release -p:Platform=x64 -clp:ForceConsoleColor -warnaserror ${{ github.workspace }}\Demo\Demo.slnx
29+
30+
- name: Build ARM64
31+
run: msbuild -restore -p:RestorePackagesConfig=true -p:Configuration=Release -p:Platform=ARM64 -clp:ForceConsoleColor -warnaserror ${{ github.workspace }}\Demo\Demo.slnx
32+
33+
- name: Prepare artifacts for release
34+
run: |
35+
New-Item -ItemType Directory -Path .\artifacts
36+
Copy-Item -Path ${{ github.workspace }}\Demo\Packaging\AppPackages\Packaging_1.0.0.0_x86_Test\Packaging_1.0.0.0_x86.msix -Destination .\artifacts\MyApplication_x86.msix
37+
Copy-Item -Path ${{ github.workspace }}\Demo\Packaging\AppPackages\Packaging_1.0.0.0_x64_Test\Packaging_1.0.0.0_x64.msix -Destination .\artifacts\MyApplication_x64.msix
38+
Copy-Item -Path ${{ github.workspace }}\Demo\Packaging\AppPackages\Packaging_1.0.0.0_ARM64_Test\Packaging_1.0.0.0_ARM64.msix -Destination .\artifacts\MyApplication_ARM64.msix
39+
40+
- name: Delete all previous releases and tags
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
# Get a list of all existing releases and extract tag names
45+
# Use --json flag to get machine-readable, structured data
46+
$releasesJson = gh release list --json name,tagName
47+
48+
# Parse the JSON output in PowerShell
49+
$releases = $releasesJson | ConvertFrom-Json
50+
51+
foreach ($release in $releases) {
52+
Write-Host "Deleting release: $($release.name)"
53+
# Delete the release and its associated tag
54+
gh release delete "$($release.tagName)" -y --cleanup-tag
55+
}
56+
57+
- name: Generate release name
58+
id: dynamic_version
59+
run: |
60+
# Get current date in YYYY-MM-DD format (colons are not allowed in tag/release names)
61+
$currentDate = Get-Date -Format 'yyyy-MM-dd'
62+
# Get the short commit SHA (first 7 characters) from the built-in GITHUB_SHA variable
63+
$commitHashShort = "${{ github.sha }}".Substring(0, 7)
64+
$releaseName = "Demo Application Release $currentDate-$commitHashShort"
65+
66+
# Make these variables available as outputs for subsequent steps
67+
echo "release_name=$releaseName" >> $env:GITHUB_OUTPUT
68+
69+
- name: Publish release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: latest
73+
name: ${{ steps.dynamic_version.outputs.release_name }}
74+
body: |
75+
Latest demo application MSIX package automatically built by GitHub Actions.
76+
77+
Since it is unsigned, it can only be installed on Windows 11 using the following command in an elevated PowerShell for testing purposes.
78+
79+
```powershell
80+
Add-AppxPackage -Path MyApplication.msix -AllowUnsigned
81+
```
82+
83+
draft: false
84+
prerelease: false
85+
files: artifacts/*

0 commit comments

Comments
 (0)