ci: Set version to '1.2' #72
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- release/** | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
- release/** | |
concurrency: | |
group: ${{github.workflow}} - ${{github.ref}} | |
cancel-in-progress: true | |
jobs: | |
build-tools: | |
name: Build Tools | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 | |
id: nbgv | |
with: | |
toolVersion: 3.6.139 | |
setAllVars: true | |
- name: Build - CI | |
run: | | |
$adjustedPackageVersion="${{ steps.nbgv.outputs.SemVer2 }}".ToLower(); | |
dotnet build src/NvGet.sln /p:PackageVersion=$adjustedPackageVersion /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }} "/p:PackageOutputPath=$env:GITHUB_WORKSPACE\artifacts" /p:GeneratePackageOnBuild=true | |
- name: Run Unit Tests | |
run: | | |
cd src | |
dotnet test | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NuGet | |
path: .\artifacts | |
build-extensions: | |
name: Build Extensions | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.300' | |
- uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 | |
id: nbgv | |
with: | |
toolVersion: 3.6.139 | |
setAllVars: true | |
- name: Install tfx | |
working-directory: extensions/azuredevops | |
run: npm install [email protected] -g --no-audit --no-fund | |
- name: npm install | |
working-directory: extensions/azuredevops | |
run: npm install | |
- name: Compile | |
working-directory: extensions/azuredevops | |
run: .\node_modules\.bin\tsc -project .\tsconfig.json --listEmittedFiles --locale en-US --isolatedModules | |
- name: Update Versions | |
run: | | |
$taskManifest = Get-Content -Path .\extensions\azuredevops\canaryUpdater\task.json -Raw | ConvertFrom-Json | |
$taskManifest.version.Major = "${{ steps.nbgv.outputs.VersionMajor }}" | |
$taskManifest.version.Minor = "${{ steps.nbgv.outputs.VersionMinor }}" | |
$taskManifest.version.Patch = "${{ steps.nbgv.outputs.BuildNumber }}" | |
$taskManifest | ConvertTo-Json -Depth 100 | Set-Content -Path .\extensions\azuredevops\canaryUpdater\task.json | |
- name: Package Extension | |
working-directory: extensions/azuredevops | |
run: tfx extension create --json --no-color --output-path .\artifacts\Build.Tasks.${{ steps.nbgv.outputs.SemVer2 }}.vsix --override "{""version"":""${{ steps.nbgv.outputs.SemVer2 }}""}" | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: extensions | |
path: extensions/azuredevops/artifacts | |
sign: | |
name: Sign Packages | |
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }} | |
runs-on: windows-latest | |
needs: | |
- build-extensions | |
- build-tools | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: NuGet | |
path: artifacts | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '3.1.x' | |
- name: Setup SignClient | |
run: | | |
dotnet tool install --tool-path build SignClient | |
- name: SignClient | |
shell: pwsh | |
run: | | |
build\SignClient sign -i artifacts\*.nupkg -c build\SignClient.json -r "${{ secrets.UNO_PLATFORM_CODESIGN_USERNAME }}" -s "${{ secrets.UNO_PLATFORM_CODESIGN_SECRET }}" -n "Uno Nuget Tools" -d "Uno Nuget Tools" -u "https://github.com/unoplatform/nuget.updater" | |
- name: Upload Signed Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NuGet-Signed | |
path: .\artifacts | |
publish_nuget_dev: | |
name: Publish NuGet Dev | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
runs-on: windows-latest | |
needs: | |
- sign | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: NuGet-Signed | |
path: artifacts | |
- name: NuGet Push | |
shell: pwsh | |
run: | | |
dotnet nuget push artifacts\*.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_ORG_API_KEY }}" | |
publish_nuget_prod: | |
name: Publish NuGet Production | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }} | |
runs-on: windows-latest | |
environment: 'Nuget Production' | |
needs: | |
- sign | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: NuGet-Signed | |
path: artifacts | |
- name: NuGet Push | |
shell: pwsh | |
run: | | |
dotnet nuget push artifacts\*.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_ORG_API_KEY }}" | |
publish_extensions_prod: | |
name: Publish Extensions Production | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }} | |
runs-on: windows-latest | |
environment: 'Extension Production' | |
needs: | |
- build-extensions | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: extensions | |
path: artifacts | |
- name: Install tfx | |
working-directory: extensions/azuredevops | |
run: npm install [email protected] -g --no-audit --no-fund | |
- name: Publish to VS Marketplace | |
shell: pwsh | |
run: | | |
$vsix = Get-ChildItem -Path .\artifacts -Filter *.vsix | Select-Object -First 1 | |
tfx extension publish --vsix "$vsix" --no-wait-validation -t "${{ secrets.VS_VSIX_PAT }}" | |