forked from fullstackhero/dotnet-microservices-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (73 loc) · 3.1 KB
/
fluentpos-cicd.yaml
File metadata and controls
76 lines (73 loc) · 3.1 KB
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
name: fluentpos
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
build_gateway_image:
type: boolean
description: push gateway image
build_identity_image:
type: boolean
description: push identity image
build_catalog_image:
type: boolean
description: push catalog image
build_cart_image:
type: boolean
description: push cart image
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
working-directory: ./fluentpos/
run: dotnet restore
- name: Build
working-directory: ./fluentpos/
run: dotnet build --no-restore
- name: Test
working-directory: ./fluentpos/
run: dotnet test --no-build --verbosity normal
docker:
name: Docker
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- if: github.event.inputs.build_gateway_image == 'true' || github.ref == 'refs/heads/main'
name: Build Gateway Image
working-directory: ./
run: |
dotnet publish fluentpos/gateways/Gateway/Gateway.csproj --os linux --arch x64 -c Release -p:PublishProfile=DefaultContainer -p:ContainerImageName=${{ secrets.DOCKER_USERNAME }}/fluentpos.gateway
docker push ${{ secrets.DOCKER_USERNAME }}/fluentpos.gateway --all-tags
- if: github.event.inputs.build_identity_image == 'true' || github.ref == 'refs/heads/main'
name: Build Identity Server Image
working-directory: ./
run: |
dotnet publish fluentpos/services/identity/Api/Api.csproj --os linux --arch x64 -c Release -p:PublishProfile=DefaultContainer -p:ContainerImageName=${{ secrets.DOCKER_USERNAME }}/fluentpos.identity
docker push ${{ secrets.DOCKER_USERNAME }}/fluentpos.identity --all-tags
- if: github.event.inputs.build_catalog_image == 'true' || github.ref == 'refs/heads/main'
name: Build Catalog Service Image
working-directory: ./
run: |
dotnet publish fluentpos/services/catalog/Api/Api.csproj --os linux --arch x64 -c Release -p:PublishProfile=DefaultContainer -p:ContainerImageName=${{ secrets.DOCKER_USERNAME }}/fluentpos.catalog
docker push ${{ secrets.DOCKER_USERNAME }}/fluentpos.catalog --all-tags
- if: github.event.inputs.build_cart_image == 'true' || github.ref == 'refs/heads/main'
name: Build Cart Service Image
working-directory: ./
run: |
dotnet publish fluentpos/services/cart/Api/Api.csproj --os linux --arch x64 -c Release -p:PublishProfile=DefaultContainer -p:ContainerImageName=${{ secrets.DOCKER_USERNAME }}/fluentpos.cart
docker push ${{ secrets.DOCKER_USERNAME }}/fluentpos.cart --all-tags