Merge dev to master v0.0.04 #216
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Build and Publish | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ dev ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, macos-12, macos-latest] | |
architecture: [x64, arm64] | |
exclude: | |
- os: macos-12 | |
architecture: arm64 | |
- os: macos-latest | |
architecture: x64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ runner.os == 'windows-latest' && 'win-packages' || 'osx-${{ matrix.architecture }}-packages' }} | |
key: ${{ runner.os }}-nuget-${{ matrix.architecture }}-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os == 'windows-latest' && 'win-nuget' || 'mac-nuget' }} | |
- name: Publish | |
run: | | |
if ($env:RUNNER_OS -eq "Windows") { | |
if ($env:RUNNER_ARCH -eq "x64") { | |
./build.ps1 -Runtime win-x64 -PublishAot | |
New-Item -ItemType Directory -Path "win-x64" | |
Move-Item -Path ".\publish" -Destination "$env:GITHUB_WORKSPACE\win-x64\publish" | |
Get-ChildItem -Path "$env:GITHUB_WORKSPACE\win-x64\publish" | |
} | |
else { | |
./build.ps1 -Runtime win-arm64 -PublishAot | |
New-Item -ItemType Directory -Path "win-arm64" | |
Move-Item -Path ".\publish" -Destination "$env:GITHUB_WORKSPACE\win-arm64\publish" | |
Get-ChildItem -Path "$env:GITHUB_WORKSPACE\win-arm64\publish" | |
} | |
} | |
elseif ($env:RUNNER_OS -eq "macOS-12") { | |
./build.ps1 -Runtime osx-x64 -PublishAot | |
New-Item -ItemType Directory -Path "osx-x64" | |
Move-Item -Path "Key Vault Explorer.app" -Destination "$env:GITHUB_WORKSPACE\osx-x64\Key Vault Explorer.app" | |
} | |
else { | |
./build.ps1 -Runtime osx-arm64 -PublishAot | |
New-Item -ItemType Directory -Path "osx-arm64" | |
Move-Item -Path "Key Vault Explorer.app" -Destination "$env:GITHUB_WORKSPACE\osx-arm64\Key Vault Explorer.app" | |
} | |
shell: pwsh | |
- name: Create Package | |
run: | | |
if ($env:RUNNER_OS -eq "Windows") { | |
if ($env:RUNNER_ARCH -eq "x64") { | |
tar -cvf keyvaultexplorer.win-x64.tar win-x64 | |
} | |
else { | |
tar -cvf keyvaultexplorer.win-arm64.tar win-arm64 | |
} | |
} | |
elseif ($env:RUNNER_OS -eq "macOS-12") { | |
tar -cvf keyvaultexplorer.osx-x64.tar osx-x64 | |
} | |
else { | |
tar -cvf keyvaultexplorer.osx-arm64.tar osx-arm64 | |
} | |
shell: pwsh | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os == 'windows-latest' && (matrix.architecture == 'x64' && 'keyvaultexplorer.win-x64' || 'keyvaultexplorer.win-arm64') || (matrix.os == 'macos-12' && 'keyvaultexplorer.osx-x64' || 'keyvaultexplorer.osx-arm64') }} | |
path: ${{ matrix.os == 'windows-latest' && (matrix.architecture == 'x64' && 'keyvaultexplorer.win-x64.tar' || 'keyvaultexplorer.win-arm64.tar') || (matrix.os == 'macos-12' && 'keyvaultexplorer.osx-x64.tar' || 'keyvaultexplorer.osx-arm64.tar') }} | |
release: | |
name: Release code | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: keyvaultexplorer.* | |
- name: Create Release | |
run: | | |
Get-ChildItem -Recurse | |
gh release create v0.0.${{github.run_attempt}} --draft | |
gh release upload v0.0.${{github.run_attempt}} "./keyvaultexplorer.win-x64.tar" "./keyvaultexplorer.win-arm64.tar" "./keyvaultexplorer.osx-arm64.tar" "./keyvaultexplorer.osx-x64.tar" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: pwsh |