-
Notifications
You must be signed in to change notification settings - Fork 2.4k
85 lines (84 loc) · 3.25 KB
/
release_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
name: Release - CI
on:
push:
paths-ignore:
- '**/*.md'
- 'mkdocs.yml'
- 'src/docs/**/*'
tags:
- 'v*.*.*'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
runs-on: ${{ matrix.os }}
name: Build, Test, Deploy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Get the version
id: get_version
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
VERSION="${VERSION//v}"
echo VERSION:${VERSION}
echo ::set-output name=VERSION::${VERSION}
shell: bash
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "15"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Set build number
if: matrix.os == 'ubuntu-latest'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 15471 ))" >> $GITHUB_ENV
- name: Build
run: |
dotnet build -c Release -p:Version=${{ steps.get_version.outputs.VERSION }}
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
- name: Functional Tests
if: matrix.os == 'ubuntu-latest'
run: |
cd test/OrchardCore.Tests.Functional
npm install
npm run cms:test
npm run mvc:test
- uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest' && failure()
with:
name: Functional Test failure
path: |
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data_Tests/logs
- name: Deploy release NuGet packages
if: matrix.os == 'ubuntu-latest'
run: |
dotnet pack -c Release --no-build -p:Version=${{ steps.get_version.outputs.VERSION }} -p:TreatWarningsAsErrors=false
dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Set up Docker Buildx
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: matrix.os == 'ubuntu-latest'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy release docker images
if: matrix.os == 'ubuntu-latest'
shell: pwsh
run: |
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false
$output = [System.IO.Path]::GetFullPath("./.build/release")
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0
docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:latest -t orchardproject/orchardcore-cms-linux:${{ steps.get_version.outputs.VERSION }} --push .
docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:latest -t orchardproject/orchardcore-cms-windows:${{ steps.get_version.outputs.VERSION }} --push .