-
Notifications
You must be signed in to change notification settings - Fork 2
147 lines (115 loc) · 5.91 KB
/
CI-NETCore.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
name: CI - Nuget Packages
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: Build & Push .NET packages
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version-generator.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Set Version Number
id: version-generator
run: echo "version=$(date +'%Y.%m.%d').$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.406'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Create artifacts folder
run: |
mkdir "$GITHUB_WORKSPACE/artifacts"
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database"
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web"
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService"
mkdir "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ShoppingCartService"
- name: Publish OctoPetShopDatabase
run: dotnet publish OctopusSamples.OctoPetShop.Database/OctopusSamples.OctoPetShop.Database.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database"
- name: Publish OctoPetShopWeb
run: dotnet publish OctopusSamples.OctoPetShop.Web/OctopusSamples.OctoPetShop.Web.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web"
- name: Publish OctoPetShopProductService
run: dotnet publish OctopusSamples.OctoPetShop.ProductService/OctopusSamples.OctoPetShop.ProductService.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService"
- name: Publish OctoPetShopShoppingCartService
run: dotnet publish OctopusSamples.OctoPetShop.ShoppingCartService/OctopusSamples.OctoPetShop.ShoppingCartService.csproj --configuration Release --no-restore --output "$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetshop.ShoppingCartService"
- name: Install Octopus CLI
uses: OctopusDeploy/[email protected]
with:
version: latest
- name: Package OctoPetShopDatabase
run: |
octo pack --id="OctoPetShop.Database" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Database" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Package OctoPetShopWeb
run: |
octo pack --id="OctoPetShop.Web" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.Web" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Package OctoPetShopProductService
run: |
octo pack --id="OctoPetShop.ProductService" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetShop.ProductService" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Package OctoPetShopShoppingCartService
run: |
octo pack --id="OctoPetShop.ShoppingCartService" --format="Zip" --version="${{ steps.version-generator.outputs.version }}" --basePath="$GITHUB_WORKSPACE/artifacts/OctopusSamples.OctoPetshop.ShoppingCartService" --outFolder="$GITHUB_WORKSPACE/artifacts"
- name: Push OctoPetShop Packages
uses: OctopusDeploy/[email protected]
with:
api_key: ${{ secrets.OCTOPUS_API_KEY }}
server: ${{ secrets.OCTOPUS_SERVER_URL }}
space: ${{ secrets.OCTOPUS_SPACE_NAME }}
packages: |
artifacts/OctoPetShop.Database.${{ steps.version-generator.outputs.version }}.zip
artifacts/OctoPetShop.Web.${{ steps.version-generator.outputs.version }}.zip
artifacts/OctoPetShop.ProductService.${{ steps.version-generator.outputs.version }}.zip
artifacts/OctoPetShop.ShoppingCartService.${{ steps.version-generator.outputs.version }}.zip
Push-build-information:
name: Push Build Information to Octopus 🐙
needs: build
runs-on: ubuntu-latest
env:
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
steps:
- uses: OctopusDeploy/push-build-information-action@v3
name: Push Build Information
with:
version: ${{ needs.build.outputs.version }}
packages: |
OctoPetShop.Database
OctoPetShop.Web
OctoPetShop.ProductService
OctoPetShop.ShoppingCartService
Create-Octopus-Release:
name: Create Octopus Release 🐙
needs: [build, Push-build-information]
runs-on: ubuntu-latest
env:
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
steps:
- uses: OctopusDeploy/create-release-action@v3
id: "create-release"
with:
project: "OctoPetShop - IIS"
outputs:
release_number: ${{ steps.create-release.outputs.release_number }}
Create-Octopus-Release-Tenant:
if: false
name: Create Octopus Release - Tenant 🐙
needs: [build, Push-build-information]
runs-on: ubuntu-latest
env:
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
OCTOPUS_SPACE: ${{ secrets.OCTOPUS_SPACE }}
steps:
- uses: OctopusDeploy/create-release-action@v3
id: "create-release"
with:
project: "Point of Sale"
outputs:
release_number: ${{ steps.create-release.outputs.release_number }}