OpenRia Build #217
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: OpenRia Build | |
env: | |
solution: 'OpenRiaServices.OpenSilver.sln' | |
opensilver-package-source: 'https://www.myget.org/F/opensilver/api/v3/index.json' | |
next-release-version: '2.3.0' | |
suffix: 'preview' | |
on: | |
# We run the process manually and pass the version of actual OpenSilver | |
workflow_dispatch: | |
inputs: | |
opensilver-version: | |
description: 'OpenSilver package version' | |
default: 'latest' | |
required: true | |
schedule: | |
# Every Sunday at 5AM UTC | |
- cron: "0 5 * * 0" | |
jobs: | |
OpenRia-Build: | |
runs-on: windows-latest | |
steps: | |
- uses: microsoft/[email protected] | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.101' | |
- name: Clone repo | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Add Rc package source | |
run: | | |
nuget sources Add -Name opensilver-private-rc -Source "${{ secrets.MYGET_PRIVATE_RC_FEED_V3 }}" -username "${{ secrets.MYGET_PRIVATE_USERNAME }}" -password "${{ secrets.MYGET_PRIVATE_APIKEY }}" | |
if: env.suffix == 'rc' | |
- name: Fill vars | |
id: vars | |
run: | | |
$version = "${{ github.event.inputs.opensilver-version }}" | |
$source = "${{ env.opensilver-package-source }}" | |
$suffix = "${{ env.suffix }}" | |
if ($suffix -eq "rc") { | |
$source = "${{ secrets.MYGET_PRIVATE_RC_FEED_V3 }}" | |
} | |
if ($version -eq "latest" -or $version -eq "") { | |
$version = nuget list -Source $source -Prerelease | ? { $_ -match "^OpenSilver\s+(.*)" } | ForEach { $_.split(" ")[1] } | |
} | |
echo "Version: $version" | |
echo "::set-output name=opensilver-version::$version" | |
echo "::set-output name=suffix::$(date +'%Y-%m-%d-%H%M%S')-${{ env.GITHUB_SHA_SHORT }}" | |
- name: Remove OpenSilver packages for all projects | |
working-directory: src | |
run: | | |
foreach ($project in dotnet sln ${{ env.solution }} list | Select-Object -Skip 2) { | |
dotnet remove $project package OpenSilver | |
if (-not $?) {throw "Failed to remove package"} | |
} | |
env: | |
DOTNET_NOLOGO: true | |
- name: Add OpenSilver package for all projects | |
working-directory: src | |
run: | | |
foreach ($project in dotnet sln ${{ env.solution }} list | Select-Object -Skip 2) { | |
dotnet add $project package OpenSilver -v ${{ steps.vars.outputs.opensilver-version }} | |
if (-not $?) {throw "Failed to add package"} | |
} | |
env: | |
DOTNET_NOLOGO: true | |
- name: Build solution | |
working-directory: src | |
run: | | |
msbuild ${{ env.solution }} -p:Configuration=Release -clp:ErrorsOnly -restore | |
- name: Format Version Suffix | |
id: format-suffix | |
run: echo "::set-output name=suffix::$(date +'%Y-%m-%d-%H%M%S')-${{ env.GITHUB_SHA_SHORT }}" | |
- name: Format Package Version | |
id: format-version | |
run: echo "::set-output name=version::${{ env.next-release-version }}-${{env.suffix}}-${{ steps.format-suffix.outputs.suffix }}" | |
- name: Build packages | |
working-directory: NuGet | |
run: | | |
.\Pack-Client-OpenSilver.ps1 -Version ${{ steps.format-version.outputs.version }} -OpenSilverDependencyVersion ${{ steps.vars.outputs.opensilver-version }} -RepositoryUrl https://github.com/${{ env.GITHUB_REPOSITORY_OWNER_PART }}/${{ env.GITHUB_REPOSITORY_NAME_PART }} | |
- name: Upload packages | |
run: | | |
dotnet nuget push "NuGet\bin\opensilver\*.nupkg" -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ env.GITHUB_REPOSITORY_OWNER_PART }}/index.json | |
- name: Upload packages to MyGet | |
if: github.repository_owner == 'OpenSilver' && env.suffix == 'preview' | |
run: | | |
dotnet nuget push "NuGet\bin\opensilver\*.nupkg" -k ${{ secrets.MYGET_TOKEN }} -s https://www.myget.org/F/opensilver/api/v2/package | |
- name: Upload packages to MyGet RC | |
if: github.repository_owner == 'OpenSilver' && env.suffix == 'rc' | |
run: | | |
dotnet nuget push "NuGet\bin\opensilver\*.nupkg" -k ${{ secrets.MYGET_PRIVATE_RC_FEED_TOKEN }} -s ${{ secrets.MYGET_PRIVATE_RC_FEED }} | |
- name: Pack OpenRia Final Release | |
working-directory: NuGet | |
run: | | |
.\Pack-Client-OpenSilver.ps1 -Version ${{ env.next-release-version }} -OpenSilverDependencyVersion ${{ env.next-release-version }} -RepositoryUrl https://github.com/${{ env.GITHUB_REPOSITORY_OWNER_PART }}/${{ env.GITHUB_REPOSITORY_NAME_PART }} | |
if: env.suffix == 'rc' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: OpenRia5 | |
path: "NuGet/bin/opensilver" |