-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (96 loc) · 3.4 KB
/
main-build.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
name: .NET
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: YYDDD
- name: Set environment
run: |
echo "version=1.0.${{steps.current-time.outputs.formattedTime}}.${{github.run_number}}" >> $GITHUB_ENV
- name: Write version
shell: pwsh
run: |
$projFiles = Get-Childitem -Include *ServiceHost.csproj, *Abstract.csproj, *Api.csproj, *PgSink.csproj -Recurse
$version = "${{ env.version }}"
foreach($projFile in $projFiles)
{
Write-Host "Writing version $version in $projFile"
[xml]$projXml = Get-Content -Path $projFile
$projXml.Project.PropertyGroup.AssemblyVersion = $version
$projXml.Project.PropertyGroup.Version = "$version-stable"
$projXml.Save($projFile)
}
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push API
uses: docker/build-push-action@v2
with:
context: .
file: ./IB.WatchCluster.Api/Dockerfile
push: true
tags: ilaverlin/watchcluster-api:latest,ilaverlin/watchcluster-api:${{ env.version }}
- name: Build and push ServiceHost
uses: docker/build-push-action@v2
with:
context: .
file: ./IB.WatchCluster.ServiceHost/Dockerfile
push: true
tags: ilaverlin/watchcluster-servicehost:latest,ilaverlin/watchcluster-servicehost:${{ env.version }}
- name: Build and push DbSink
uses: docker/build-push-action@v2
with:
context: .
file: ./IB.WatchCluster.DbSink/Dockerfile
push: true
tags: ilaverlin/watchcluster-dbsink:latest,ilaverlin/watchcluster-dbsink:${{ env.version }}
- name: Build and push YasTelegramBot
uses: docker/build-push-action@v2
with:
context: .
file: ./IB.WatchCluster.YasTelegramBot/Dockerfile
push: true
tags: ilaverlin/yas-bot:latest,ilaverlin/yas-bot:${{ env.version }}
# - name: Build and push Migration
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./IB.WatchCluster.DbMigration/Dockerfile
# push: true
# tags: ilaverlin/watchcluster-migration:latest,ilaverlin/watchcluster-migration:${{ env.version }}
- name: Build and push yas api
uses: docker/build-push-action@v2
with:
context: ./IB.YasDataApi
file: ./IB.YasDataApi/cmd/yas_rest/Dockerfile
push: true
tags: ilaverlin/yas-restapi:latest,ilaverlin/yas-rest:${{ env.version }}
- name: Build and push yas processor
uses: docker/build-push-action@v2
with:
context: ./IB.YasDataApi
file: ./IB.YasDataApi/cmd/yas_processor/Dockerfile
push: true
tags: ilaverlin/yas-processor:latest,ilaverlin/yas-processor:${{ env.version }}