-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (70 loc) · 3.58 KB
/
CICD-containers.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
name: CI - Containers
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: Build & Push Docker Imagess
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version-generator.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_SAMPLES_USERNAME }}
password: ${{ secrets.DOCKERHUB_SAMPLES_PASSWORD }}
- name: Set Version Number
id: version-generator
run: echo "version=$(date +'%Y.%m.%d').$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
- name: Build OctoPetShop web container
run: |
docker build ./OctopusSamples.OctoPetShop.Web --file ./OctopusSamples.OctoPetShop.Web/dockerfile --tag octopussamples/octopetshop-web-enterprise:${{ steps.version-generator.outputs.version }}
docker push octopussamples/octopetshop-web-enterprise:${{ steps.version-generator.outputs.version }}
- name: Build OctoPetShop product service container
run: |
docker build ./OctopusSamples.OctoPetShop.ProductService --file ./OctopusSamples.OctoPetShop.ProductService/dockerfile --tag octopussamples/octopetshop-productservice-enterprise:${{ steps.version-generator.outputs.version }}
docker push octopussamples/octopetshop-productservice-enterprise:${{ steps.version-generator.outputs.version }}
- name: Build OctoPetShop shopping cart container
run: |
docker build ./OctopusSamples.OctoPetShop.ShoppingCartService --file ./OctopusSamples.OctoPetShop.ShoppingCartService/dockerfile --tag octopussamples/octopetshop-shoppingcartservice-enterprise:${{ steps.version-generator.outputs.version }}
docker push octopussamples/octopetshop-shoppingcartservice-enterprise:${{ steps.version-generator.outputs.version }}
- name: Build OctoPetShop database container
run: |
docker build ./OctopusSamples.OctoPetShop.Database --file ./OctopusSamples.OctoPetShop.Database/dockerfile --tag octopussamples/octopetshop-database-enterprise:${{ steps.version-generator.outputs.version }}
docker push octopussamples/octopetshop-database-enterprise:${{ steps.version-generator.outputs.version }}
Push-build-information:
name: 🐙Push Build Information
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: |
octopussamples/octopetshop-web-enterprise
octopussamples/octopetshop-productservice-enterprise
octopussamples/octopetshop-shoppingcartservice-enterprise
octopussamples/octopetshop-database-enterprise
Create-Octopus-Release:
name: 🐙Create 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: "OPS - Orchestrator"
outputs:
release_number: ${{ steps.create-release.outputs.release_number }}