-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (129 loc) · 5.33 KB
/
ci.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: CI
on:
create:
branches:
- release/**
push:
branches:
- master
- dev/**
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
- closed
permissions:
contents: write
pull-requests: write
packages: write
jobs:
build:
env:
BUILD_CONFIG: 'Release'
runs-on: windows-latest
continue-on-error: true
steps:
- name: Support Git long paths on Windows
run: git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Setup .NET 7 SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Setup .NET WASM workload
run: dotnet workload install wasm-experimental
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Restore tools
run: dotnet tool restore
- name: Build and install workload
run: dotnet cake build.cake --target=InstallWorkload --configuration=$env:BUILD_CONFIG --build-version=${{ steps.gitversion.outputs.majorMinorPatch }} --package-version=${{ steps.gitversion.outputs.semVer }}
- name: Build and package test framework
run: dotnet cake build.cake --target=BuildAndPackageTestFramework --configuration=$env:BUILD_CONFIG --build-version=${{ steps.gitversion.outputs.majorMinorPatch }} --package-version=${{ steps.gitversion.outputs.semVer }}
- name: Build and package additional libraries
run: dotnet cake build.cake --target=BuildAndPackageAdditionalNuGetPackages --configuration=$env:BUILD_CONFIG --build-version=${{ steps.gitversion.outputs.majorMinorPatch }} --package-version=${{ steps.gitversion.outputs.semVer }}
- name: Build and publish sample app
run: dotnet publish sample/Trungnt2910.Browser.Sample/Trungnt2910.Browser.Sample.csproj --configuration $env:BUILD_CONFIG -p:Version=${{ steps.gitversion.outputs.assemblySemVer }} --framework=net7.0-browser
- name: Build and publish azureams.github.io clone
run: dotnet publish sample/azureams.github.io/azureams.github.io.csproj --configuration $env:BUILD_CONFIG -p:Version=${{ steps.gitversion.outputs.assemblySemVer }} --framework=net7.0-browser
- name: Publish sample app artifact
uses: actions/upload-artifact@v2
with:
name: sample_app
path: sample/Trungnt2910.Browser.Sample/bin/${{ env.BUILD_CONFIG }}/net7.0-browser/browser-wasm/AppBundle
- name: Publish azureams.github.io clone artifact
uses: actions/upload-artifact@v2
with:
name: azureams.github.io
path: sample/azureams.github.io/bin/${{ env.BUILD_CONFIG }}/net7.0-browser/browser-wasm/AppBundle
- name: Publish nuget artifacts
uses: actions/upload-artifact@v2
with:
name: packages.${{ steps.gitversion.outputs.semVer }}
path: out/nuget/**
- name: Setup Microsoft Edge
uses: browser-actions/setup-edge@latest
- name: Kick start Microsoft Edge
run: msedge
- name: Run workload tests
uses: trungnt2910/retry@9685ccb9a1f6bb6fff53c5e7639a39b743f7527a
with:
timeout_minutes: 15
max_attempts: 5
retry_on: timeout
command: dotnet cake build.cake --target=RunWorkloadTests --configuration=$env:BUILD_CONFIG --build-version=${{ steps.gitversion.outputs.majorMinorPatch }} --package-version=${{ steps.gitversion.outputs.semVer }}
- name: Publish on GitHub
if: ${{ github.event_name != 'pull_request' }}
run: |
dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget push out/nuget/** --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
# - name: Publish dev
# if: github.ref == 'refs/heads/master'
# run: nuget push .nupkgs\** -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
# - name: Publish
# if: startsWith(github.ref, 'refs/heads/release')
# run: nuget push .nupkgs\** -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download sample app artifact
uses: actions/download-artifact@v3
with:
name: sample_app
path: sample_app
- name: Download azureams.github.io clone artifact
uses: actions/download-artifact@v3
with:
name: azureams.github.io
path: sample_app/AzureAms
- name: Deploy sample to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
folder: sample_app
clean-exclude: pr-preview/
force: false
- name: Deploy sample PR preview
uses: rossjrw/pr-preview-action@v1
if: ${{ github.event_name == 'pull_request' }}
with:
source-dir: sample_app