7.0.0 release #7
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*.*.* | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repos | |
uses: actions/checkout@v4 | |
- name: Setup NuGet | |
uses: nuget/setup-nuget@v2 | |
with: | |
nuget-api-key: ${{secrets.NUGET_API_KEY}} | |
nuget-version: 5.x | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore source | |
run: | | |
dotnet restore ${{env.TARGET_FILE}} | |
env: | |
TARGET_FILE: source/Karamem0.SPClientCore/Karamem0.SPClientCore.csproj | |
- name: Build source | |
run: | | |
dotnet publish ${{env.TARGET_FILE}} ` | |
-c Release ` | |
-p:PublishDir=build ` | |
-p:Version=${{vars.BUILD_VERSION}}.${{github.run_number}} ` | |
-p:FileVersion=${{vars.BUILD_VERSION}}.${{github.run_number}} | |
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 = "${{vars.BUILD_VERSION}}.${{github.run_number}}" | |
$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 "${{vars.BUILD_VERSION}}.${{github.run_number}}" -CmdletsToExport (Get-Command -Module SPClientCore | %{ $_.Name }) | |
env: | |
TARGET_FILE: source/Karamem0.SPClientCore/build/SPClientCore.psd1 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
with: | |
name: sp-client-core | |
path: SPClientCore | |
- name: Archive artifact | |
shell: pwsh | |
run: | | |
Compress-Archive -Path SPClientCore/* -DestinationPath SPClientCore_${{vars.BUILD_VERSION}}.zip | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
files: | | |
SPClientCore_${{vars.BUILD_VERSION}}.zip | |
- name: Publish to PowerShell Gallery | |
shell: pwsh | |
run: | | |
Publish-Module -Path SPClientCore -NugetApiKey ${{secrets.NUGET_API_KEY}} |