5.3.1 release #122
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
on: | |
push: | |
branches: | |
- main | |
- develop | |
tags: | |
- v*.*.* | |
env: | |
BUILD_VERSION: 5.3.1.${{github.run_number}} | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repos | |
uses: actions/checkout@v3 | |
- name: Setup NuGet | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-api-key: ${{secrets.NUGET_API_KEY}} | |
nuget-version: 5.x | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.x | |
- name: Build source | |
run: | | |
dotnet restore ${{env.TARGET_FILE}} | |
dotnet publish ${{env.TARGET_FILE}} -c Release -p:PublishDir=build -p:Version=${{env.BUILD_VERSION}} -p:FileVersion=${{env.BUILD_VERSION}} | |
env: | |
TARGET_FILE: source/Karamem0.SPClientCore/Karamem0.SPClientCore.csproj | |
- name: Update .config.json file | |
shell: pwsh | |
run: | | |
$json = Get-Content -Path "${{env.TARGET_FILE}}" | ConvertFrom-Json | |
$json.APPLICATIONINSIGHTS_CONNECTION_STRING = "${{secrets.APPLICATIONINSIGHTS_CONNECTION_STRING}}" | |
$json | ConvertTo-Json | Set-Content -Path "${{env.TARGET_FILE}}" | |
env: | |
TARGET_FILE: source/Karamem0.SPClientCore/build/SPClientCore.config.json | |
- name: Update .nuspec file | |
shell: pwsh | |
run: | | |
$xml = [xml](Get-Content -Path "${{env.TARGET_FILE}}") | |
$xml.package.metadata.version = "${{env.BUILD_VERSION}}" | |
$xml.Save("${{env.TARGET_FILE}}") | |
env: | |
TARGET_FILE: source/Karamem0.SPClientCore/build/SPClientCore.nuspec | |
- name: Update .psd1 file | |
shell: pwsh | |
run: | | |
Import-Module -Name (Resolve-Path -Path "${{env.TARGET_FILE}}") | |
Update-ModuleManifest -Path "${{env.TARGET_FILE}}" -ModuleVersion "${{env.BUILD_VERSION}}" -CmdletsToExport (Get-Command -Module SPClientCore | %{ $_.Name }) | |
env: | |
TARGET_FILE: source/Karamem0.SPClientCore/build/SPClientCore.psd1 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sp-client-core | |
path: source/Karamem0.SPClientCore/build | |
publish: | |
needs: build | |
if: contains(github.ref, 'refs/tags/') | |
runs-on: windows-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sp-client-core | |
path: SPClientCore | |
- name: Archive artifact | |
shell: pwsh | |
run: | | |
Compress-Archive -Path SPClientCore/* -DestinationPath SPClientCore_${{env.BUILD_VERSION}}.zip | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
files: | | |
SPClientCore_${{env.BUILD_VERSION}}.zip | |
- name: Publish to PowerShell Gallery | |
shell: pwsh | |
run: | | |
Publish-Module -Path SPClientCore -NugetApiKey ${{secrets.NUGET_API_KEY}} |