.NET Build and Publish #305
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 ] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build_windows: | |
name: Build Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/win-packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
win-nuget | |
- name: Publish Windows | |
run: | | |
./build.ps1 -Runtime win-x64 -PublishAot -BuildNumber '1.0.${{github.run_number }}' | |
New-Item -ItemType Directory -Path "win-x64" | |
Move-Item -Path ".\publish" -Destination "$env:GITHUB_WORKSPACE\win-x64\publish" | |
gci -path "$env:GITHUB_WORKSPACE\win-x64\publish" | |
shell: pwsh | |
- name: Create Package | |
run: tar -cvf keyvaultexplorer.win-x64.tar win-x64 | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: keyvaultexplorer.win-x64 | |
path: keyvaultexplorer.win-x64.tar | |
build_macos_intel: | |
name: Build macOS intel | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/osx-intel-packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
mac-nuget | |
- name: publish_macOS_intel | |
run: | | |
./build.ps1 -Runtime osx-x64 -PublishAot -BuildNumber '1.0.${{github.run_number }}' | |
New-Item -ItemType Directory -Path "osx-x64" | |
Move-Item -Path "Key Vault Explorer for Azure.app" -Destination "$env:GITHUB_WORKSPACE\osx-x64\Key Vault Explorer for Azure.app" | |
shell: pwsh | |
- name: Create Package | |
run: tar -cvf keyvaultexplorer.osx-x64.tar osx-x64/ | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: keyvaultexplorer.osx-x64 | |
path: keyvaultexplorer.osx-x64.tar | |
build_macos: | |
name: Build macOS Arm64 | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/macos-arm-packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-armnuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
#mac-arm-nuget | |
- name: Publish macOS Arm | |
run: | | |
./build.ps1 -Runtime osx-arm64 -PublishAot:$false -BuildNumber '1.0.${{github.run_number }}' | |
New-Item -ItemType Directory -Path "osx-arm64" | |
Move-Item -Path ".\publish" -Destination "$env:GITHUB_WORKSPACE\osx-arm64\publish" | |
Rename-Item -Path "$env:GITHUB_WORKSPACE\osx-arm64\publish\keyvaultexplorerdesktop" -NewName "Key Vault Explorer for Azure" -Force | |
shell: pwsh | |
- name: Create Package | |
run: tar -cvf keyvaultexplorer.osx-arm64.tar osx-arm64/ | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: keyvaultexplorer.osx-arm64 | |
path: keyvaultexplorer.osx-arm64.tar | |
build_linux: | |
name: Build Linux | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/linux-packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
linux-nuget | |
- name: Publish Linux | |
run: | | |
./build.ps1 -Runtime linux-x64 -PublishAot:$false -BuildNumber '1.0.${{github.run_number }}' | |
New-Item -ItemType Directory -Path "linux-x64" | |
Move-Item -Path ".\publish" -Destination "$env:GITHUB_WORKSPACE\linux-x64\publish" | |
gci -path "$env:GITHUB_WORKSPACE\linux-x64\publish" | |
shell: pwsh | |
- name: Create Package | |
run: tar -cvf keyvaultexplorer.linux-x64.tar linux-x64 | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: keyvaultexplorer.linux-x64 | |
path: keyvaultexplorer.linux-x64.tar | |
release: | |
name: Release code | |
needs: [ build_macos, build_windows, build_macos_intel, build_linux] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: keyvaultexplorer.* | |
- name: Create Release | |
run: | | |
Get-ChildItem -Recurse | |
gh release create v1.0.${{github.run_number }} --draft | |
gh release upload v1.0.${{github.run_number }} "./keyvaultexplorer.win-x64/keyvaultexplorer.win-x64.tar" "./keyvaultexplorer.osx-arm64/keyvaultexplorer.osx-arm64.tar" "./keyvaultexplorer.osx-x64/keyvaultexplorer.osx-x64.tar" "./keyvaultexplorer.linux-x64/keyvaultexplorer.linux-x64.tar" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: pwsh | |