forked from OpenRIAServices/OpenRiaServices
-
Notifications
You must be signed in to change notification settings - Fork 15
84 lines (84 loc) · 4.12 KB
/
build-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: OpenRia Build
env:
solution: 'OpenRiaServices.OpenSilver.sln'
opensilver-package-source: 'https://www.myget.org/F/opensilver/api/v3/index.json'
next-release-version: '1.2.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: Build solution
run: |
msbuild ${{ env.solution }} -p:Configuration=Release -p:OpenSilverPackageVersion=${{ steps.vars.outputs.opensilver-version }} -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: Pack packages
working-directory: OpenRiaServices.NuGet
run: |
.\Pack-Client-OS.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 "OpenRiaServices.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 "OpenRiaServices.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 "OpenRiaServices.NuGet\bin\opensilver\*.nupkg" -k ${{ secrets.MYGET_PRIVATE_RC_FEED_TOKEN }} -s ${{ secrets.MYGET_PRIVATE_RC_FEED }}
- name: Pack OpenRia Final Release
working-directory: OpenRiaServices.NuGet
run: |
.\Pack-Client-OS.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: OpenRia4.6
path: "OpenRiaServices.NuGet/bin/OpenSilver"