Browse Source

Build for ARM64 & Specify version through workflow

Automates the release process further by allowing me to execute the action through GitHub while specifying the version number while it automatically inserts it into the publish builds and creates a tag.

Also removes the source revision in the informational version number when using .NET 8+ SDKs.

Closes #60
Closes #55
Daniel Chalmers 9 months ago
parent
commit
54812faf2b

+ 13 - 6
.github/actions/prepare-for-release/action.yml

@@ -2,6 +2,14 @@ name: Prepare for release
 
 description: Builds, tests, and creates an installer that's ready for release.
 
+inputs:
+  version:
+    description: 'Version number for the app'
+    default: '0.0.0'
+  rids:
+    description: 'Runtime identifiers for the build'
+    default: 'win-x64 win-arm64'
+
 runs:
   using: "composite"
   steps:
@@ -16,14 +24,13 @@ runs:
       run: dotnet test
 
     - name: Publish
-      shell: bash
-      run: dotnet publish ./DesktopClock/DesktopClock.csproj -o "publish" -c Release -r win-x64
-
-    - name: Create installer
       shell: bash
       run: |
-        dotnet tool install --global wix --version 4.0.5
-        wix build Product.wxs -o "publish/Install DesktopClock.msi"
+        dotnet tool install --global wix --version 4.0.6
+        for rid in ${{ inputs.rids }}; do
+          dotnet publish ./DesktopClock/DesktopClock.csproj -o "publish/$rid" -c Release -r $rid -p:Version=${{ inputs.version }}
+          wix build Product.wxs -o "publish/$rid/Install DesktopClock ${{ inputs.version }} ${rid}.msi"
+        done
 
     - uses: actions/upload-artifact@v4
       with:

+ 18 - 16
.github/workflows/deploy.yml

@@ -1,25 +1,27 @@
 name: Deploy
 
 on:
-  push:
-    tags:
-      - 'v*'
+  workflow_dispatch:
+    inputs:
+      version:
+        description: 'Version number for the app'
+        required: true
+        default: ''
 
 jobs:
   deploy:
     runs-on: windows-latest
     steps:
-      - uses: actions/checkout@v4
-      
-      - uses: ./.github/actions/prepare-for-release
+    - uses: actions/checkout@v4
+    
+    - uses: ./.github/actions/prepare-for-release
+      with:
+        version: ${{ github.event.inputs.version }}
 
-      - name: Create GitHub release
-        uses: ncipollo/release-action@v1
-        with:
-          artifacts: "publish/*.exe,publish/*.msi"
-          allowUpdates: true
-          removeArtifacts: true
-          replacesArtifacts: true
-          artifactErrorsFailBuild: true
-          makeLatest: true
-          prerelease: contains(github.ref, 'beta')
+    - name: Create GitHub release
+      uses: ncipollo/release-action@v1
+      with:
+        tag: "v${{ github.event.inputs.version }}"
+        artifacts: "publish/*/*.exe,publish/*/*.msi"
+        generateReleaseNotes: true
+        prerelease: ${{ contains(github.event.inputs.version, 'preview') }}

+ 1 - 1
DesktopClock/DesktopClock.csproj

@@ -12,7 +12,7 @@
     <Company>Daniel Chalmers</Company>
     <Description>A digital clock for your desktop that stays on screen, ready whenever you need it.</Description>
     <Copyright>© Daniel Chalmers</Copyright>
-    <Version>4.1.0</Version>
+    <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
   </PropertyGroup>
 
   <ItemGroup>