Skip to content

Commit

Permalink
Add CI/CD workflow files (#1)
Browse files Browse the repository at this point in the history
* add ci/cd workflows

* fix dotnet version

* attempt to set ACTIONS_ALLOW_UNSECURE_COMMANDS

* Update ci.yml

* Update ci.yml

* Checkout

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update ci.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update ci.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml

* Update cd.yml
  • Loading branch information
Jmorjsm authored Mar 4, 2023
1 parent 99bae6d commit 6464ce3
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 24 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build.yml

This file was deleted.

115 changes: 115 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: cd

on:
push:
# tags:
# - '*'

jobs:
build:

runs-on: windows-latest
strategy:
matrix:
dotnet-version: ['7.0']
channel: [ Dev, Prod_Sideload, Prod_Store ]
targetPlatform: [ Any CPU ]
include:

# includes the following variables for the matrix leg matching Dev
- channel: Dev
ChannelName: Dev
Configuration: Debug
#DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-dev
MsixPackageId: ElevenPercent.Dev
MsixPublisherId: CN=jmorjsm
MsixPackageDisplayName: ElevenPercent (Dev)

# includes the following variables for the matrix leg matching Prod_Sideload
- channel: Prod_Sideload
Configuration: Release
ChannelName: Prod_Sideload
#DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-prod
MsixPackageId: ElevenPercent.ProdSideload
MsixPublisherId: CN=jmorjsm
MsixPackageDisplayName: ElevenPercent (ProdSideload)

# includes the following variables for the matrix leg matching Prod_Store
- channel: Prod_Store
Configuration: Release
ChannelName: Prod_Store
DistributionUrl:
MsixPackageId: ElevenPercent.ProdStore
MsixPublisherId: CN=jmorjsm
MsixPackageDisplayName: ElevenPercent (ProdStore)

steps: # Update the appxmanifest before build by setting the per-channel values set in the matrix.
- uses: actions/checkout@v3
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.201

# - name: Update manifest version
# run: |
# [xml]$manifest = get-content ".\$env:Wap_Project_Directory\Package.appxmanifest"
# $manifest.Package.Identity.Version = "$env:NBGV_SimpleVersion.0"
# $manifest.Package.Identity.Name = "${{ matrix.MsixPackageId }}"
# $manifest.Package.Identity.Publisher = "${{ matrix.MsixPublisherId }}"
# $manifest.Package.Properties.DisplayName = "${{ matrix.MsixPackageDisplayName }}"
# $manifest.Package.Applications.Application.VisualElements.DisplayName = "${{ matrix.MsixPackageDisplayName }}"
# $manifest.save(".\$env:Wap_Project_Directory\Package.appxmanifest")

- name: Set env variables
run : |
"ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $env:GITHUB_ENV
# Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Restore the application
- name: Restore the application to populate the obj folder
run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: Debug

# Build the Windows Application Packaging project for Dev and Prod_Sideload
- name: Build the Windows Application Packaging Project (wapproj) for ${{ matrix.ChannelName }}
run: msbuild $env:Solution_Path /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:BuildMode # /p:AppxBundle=$env:AppxBundle /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
if: matrix.ChannelName != 'Prod_Store'
env:
AppxBundle: Never
AppInstallerUri: ${{ matrix.DistributionUrl }}
BuildMode: SideLoadOnly
Configuration: ${{ matrix.Configuration }}
GenerateAppInstallerFile: True
TargetPlatform: ${{ matrix.targetplatform }}

# Build the Windows Application Packaging project for Prod_Store
- name: Build the Windows Application Packaging Project (wapproj) for ${{ matrix.ChannelName }}
run: msbuild $env:Solution_Path /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:BuildMode # /p:AppxBundle=$env:AppxBundle /p:GenerateAppInstallerFile=$env:GenerateAppInstallerFile /p:AppxPackageSigningEnabled=$env:AppxPackageSigningEnabled
if: matrix.ChannelName == 'Prod_Store'
env:
AppxBundle: Never
AppxPackageSigningEnabled: False
BuildMode: StoreOnly
Configuration: ${{ matrix.Configuration }}
GenerateAppInstallerFile: False
TargetPlatform: ${{ matrix.targetplatform }}

- name: tree
run : |
tree .
- name: zip
run: |
Compress-Archive -DestinationPath Eleven-Percent.zip -Path Eleven-Percent\bin\${{matrix.Configuration}}\net7.0-windows\
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ElevenPercent.zip
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: ci

on: [push]

jobs:
build:
runs-on: windows-latest
env:
Solution_Path: eleven-percent.sln
#Test_Project_Path: MyWpfApp.Tests\MyWpfApp.Tests.csproj
Wpf_Project_Path: eleven-percent\eleven-percent.csproj
Wap_Project_Directory: ElevenPercent.Package
Wap_Project_Name: ElevenPercent.Package.wapproj
strategy:
matrix:
dotnet-version: ['7.0']
channel: [ Dev, Prod_Sideload, Prod_Store ]
targetPlatform: [ Any CPU ]
include:

# includes the following variables for the matrix leg matching Dev
- channel: Dev
ChannelName: Dev
Configuration: Debug
#DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-dev
MsixPackageId: ElevenPercent.Dev
MsixPublisherId: CN=jmorjsm
MsixPackageDisplayName: ElevenPercent (Dev)

# includes the following variables for the matrix leg matching Prod_Sideload
- channel: Prod_Sideload
Configuration: Release
ChannelName: Prod_Sideload
#DistributionUrl: https://microsoft.github.io/github-actions-for-desktop-apps-distribution-prod
MsixPackageId: ElevenPercent.ProdSideload
MsixPublisherId: CN=jmorjsm
MsixPackageDisplayName: ElevenPercent (ProdSideload)

# includes the following variables for the matrix leg matching Prod_Store
- channel: Prod_Store
Configuration: Release
ChannelName: Prod_Store
DistributionUrl:
MsixPackageId: ElevenPercent.ProdStore
MsixPublisherId: CN=jmorjsm
MsixPackageDisplayName: ElevenPercent (ProdStore)

steps:
- uses: actions/checkout@v3
- name: Install .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.201

- name: Set env variables
run : |
"ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $env:GITHUB_ENV
# Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/[email protected]

# Restore the application
- name: Restore the application to populate the obj folder
run: msbuild $env:Solution_Path /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: Debug

# Build the Windows Application Packaging project
- name: Build the Windows Application Packaging Project (wapproj)
run: msbuild $env:Solution_Path /p:Platform=$env:TargetPlatform /p:Configuration=$env:Configuration # /p:UapAppxPackageBuildMode=$env:BuildMode /p:AppxBundle=$env:AppxBundle # /p:PackageCertificateKeyFile=$env:SigningCertificate /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
env:
AppxBundle: Never
BuildMode: SideLoadOnly
Configuration: Release
TargetPlatform: ${{ matrix.targetplatform }}

- name: tree
run : |
tree .
# Upload the MSIX package: https://github.com/marketplace/actions/upload-artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: MSIX Package
path: ElevenPercent\bin\Release\net7.0-windows\eleven-percent.dll

0 comments on commit 6464ce3

Please sign in to comment.