Skip to content

Merge pull request #97 from md-owes/develop #134

Merge pull request #97 from md-owes/develop

Merge pull request #97 from md-owes/develop #134

Workflow file for this run

name: WindowsBuild
on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
workflow_dispatch:
permissions:
contents: read
env:
DOTNET_NOLOGO: true # Disable the .NET logo
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry
jobs:
calculate-version:
name: Calculate Version
runs-on: ubuntu-latest
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
preferLatestVersion: true
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
configFilePath: GitVersion.yml
build-windows:
runs-on: windows-latest
name: Windows Build
needs: calculate-version
env:
SEMVER: ${{ needs.calculate-version.outputs.semVer }}
PUBLISH_DIR: 'directory-deleter\bin\publish'
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
token: ${{ secrets.GITRELEASEMANAGERALLACCESS }}
- uses: action-pack/set-variable@v1
with:
name: "SEMVER"
value: "${{env.SEMVER}}"
token: ${{ secrets.GITRELEASEMANAGERALLACCESS }}
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
7.0.x
- name: Setup MSBuild
uses: microsoft/[email protected]
with:
vs-version: latest
- name: Display Version
run: |
echo "SemVer: ${{env.SEMVER}}"
echo "Semver Alt: ${{ needs.calculate-version.outputs.semVer }}"
- name: Create MAUI version
uses: managedcode/MAUIAppVersion@v1
with:
csproj: 'directory-deleter\directory-deleter.csproj'
version: "0"
displayVersion: ${{env.SEMVER}}
printFile: true
- name: Update Manifest
run: .\AddVersionToMaui.ps1 ${{env.SEMVER}}.0
- name: Restore Dependencies
run: dotnet restore directory-deleter\directory-deleter.csproj
- name: Publish MAUI MSIX
run: dotnet publish -p:TargetFramework=net7.0-windows10.0.22621.0 -p:Configuration=Release -p:RestorePackages=false -p:GenerateAppxPackageOnBuild=true -p:AppxPackageDir=${{github.workspace}}\${{env.PUBLISH_DIR}}\msix\
- name: Publish MAUI EXE
run: dotnet build -p:TargetFramework=net7.0-windows10.0.22621.0 -p:Configuration=Release -p:RestorePackages=false -p:WindowsPackageType=None -o ${{github.workspace}}\${{env.PUBLISH_DIR}}\exe
- name: Display path information
run: |
echo "Workspace is ${{github.workspace}} and publish path of msix is ${{github.workspace}}\${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.msix.zip"
echo "Sha to commit ${{github.sha}}"
- name: Compress MSIX
run: Compress-Archive -Path "${{github.workspace}}\${{env.PUBLISH_DIR}}\msix\directory-deleter_${{env.SEMVER}}.0_Test\*" -Destination "${{github.workspace}}\${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.msix.zip"
- name: Compress EXE
run: Compress-Archive -Path "${{github.workspace}}\${{env.PUBLISH_DIR}}\exe\*" -Destination "${{github.workspace}}\${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.exe.zip"
- name: Publish path listing
run: |
cd "${{github.workspace}}\${{env.PUBLISH_DIR}}"
ls
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: artifacts-windows
path: |
${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.exe.zip
${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.msix.zip
- name: Upload EXE cache
uses: actions/cache/save@v3
with:
path: |
${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.exe.zip
key: directory-deleter-win-exe-v${{env.SEMVER}}
enableCrossOsArchive: true
- name: Upload MSIX cache
uses: actions/cache/save@v3
with:
path: |
${{env.PUBLISH_DIR}}\directory-deleter-v${{env.SEMVER}}.msix.zip
key: directory-deleter-win-msix-v${{env.SEMVER}}
enableCrossOsArchive: true