Skip to content

Commit b45308e

Browse files
Merge pull request #9 from TransactionProcessing/task/#2_ciworkflows
CI Workflows setup
2 parents 1f00e56 + f8d9950 commit b45308e

4 files changed

Lines changed: 176 additions & 0 deletions

File tree

.github/release-drafter.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
categories:
2+
- title: '🚀 Features'
3+
labels:
4+
- 'feature'
5+
- title: '🐛 Bug Fixes'
6+
labels:
7+
- 'bug'
8+
- title: '🧰 Maintenance'
9+
label: 'maintenance'
10+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
11+
template: |
12+
## Changes
13+
$CHANGES
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: "Release"
10+
env:
11+
ASPNETCORE_ENVIRONMENT: "Production"
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2.3.4
17+
18+
- name: Get the version
19+
id: get_version
20+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
21+
22+
- name: Restore Nuget Packages
23+
run: dotnet restore FileProcessor.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json
24+
25+
- name: Build Code
26+
run: dotnet build FileProcessor.sln --configuration Release
27+
28+
- name: Run Unit Tests
29+
run: |
30+
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
31+
dotnet test "FileProcessor.BusinessLogic.Tests\EstateManagement.BusinessLogic.Tests.csproj"
32+
33+
- name: Build Docker Images
34+
run: |
35+
docker build . --file FileProcessor/Dockerfile --tag stuartferguson/fileprocessor:latest --tag stuartferguson/fileprocessor:${{ steps.get_version.outputs.VERSION }}
36+
37+
- name: Publish Images to Docker Hub
38+
run: |
39+
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
40+
docker push stuartferguson/fileprocessor:latest
41+
docker push stuartferguson/fileprocessor:${{ steps.get_version.outputs.VERSION }}
42+
43+
- name: Publish API
44+
run: dotnet publish "FileProcessor\FileProcessor.csproj" --configuration Release --output publishOutput
45+
46+
- name: Install Octopus CLI
47+
run: |
48+
sudo apt update && sudo apt install --no-install-recommends gnupg curl ca-certificates apt-transport-https && \
49+
curl -sSfL https://apt.octopus.com/public.key | sudo apt-key add - && \
50+
sudo sh -c "echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list" && \
51+
sudo apt update && sudo apt install octopuscli
52+
53+
- name: Pack Files for Octopus
54+
run: >-
55+
octo pack
56+
--outFolder /home/runner/work/FileProcessor/FileProcessor
57+
--basePath /home/runner/work/FileProcessor/FileProcessor/publishOutput
58+
--id FileProcessor
59+
--version ${{ steps.get_version.outputs.VERSION }}
60+
--format zip
61+
--verbose
62+
--logLevel=verbose
63+
64+
- name: Push Package to Octopus
65+
run: >-
66+
octo push
67+
--server ${{ secrets.OCTOPUS_URL }}
68+
--apiKey ${{ secrets.OCTOPUS_APIKEY }}
69+
--package /home/runner/work/FileProcessor/FileProcessor/FileProcessor.${{ steps.get_version.outputs.VERSION }}.zip
70+
--overwrite-mode IgnoreIfExists
71+
72+
- name: Get Release
73+
id: getrelease
74+
uses: octokit/request-action@v2.0.17
75+
with:
76+
route: GET /repos/StuartFerguson/FileProcessor/releases/tags/${{ steps.get_version.outputs.VERSION }}
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Build Release Notes
81+
id: buildreleasenotes
82+
uses: gr2m/get-json-paths-action@v1.x
83+
with:
84+
json: ${{ steps.getrelease.outputs.data }}
85+
releasenote: "body"
86+
87+
- name: Create & Deploy Release in Octopus
88+
run: >-
89+
octo create-release
90+
--server ${{ secrets.OCTOPUS_URL }}
91+
--apiKey ${{ secrets.OCTOPUS_APIKEY }}
92+
--project "File Processor"
93+
--version ${{ steps.get_version.outputs.VERSION }}
94+
--channel Default
95+
--deployTo Development
96+
--waitfordeployment
97+
--deploymenttimeout 00:05:00
98+
--releasenotes "${{ steps.buildreleasenotes.outputs.releasenote }}"
99+
100+
#- name: Build and Publish Nuget Packages
101+
# run: |
102+
# dotnet pack "EstateManagement.Client\EstateManagement.Client.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
103+
# dotnet nuget push Nugets/EstateManagement.Client.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.MYGET_APIKEY }} --source https://www.myget.org/F/transactionprocessing/api/v2/package
104+
# dotnet pack "EstateManagement.Estate.DomainEvents\EstateManagement.Estate.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
105+
# dotnet nuget push Nugets/EstateManagement.Estate.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.MYGET_APIKEY }} --source https://www.myget.org/F/transactionprocessing/api/v2/package
106+
# dotnet pack "EstateManagement.Merchant.DomainEvents\EstateManagement.Merchant.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
107+
# dotnet nuget push Nugets/EstateManagement.Merchant.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.MYGET_APIKEY }} --source https://www.myget.org/F/transactionprocessing/api/v2/package
108+
# dotnet pack "EstateManagement.Contract.DomainEvents\EstateManagement.Contract.DomainEvents.csproj" /p:PackageVersion=${{ steps.get_version.outputs.VERSION }} --output Nugets -c Release
109+
# dotnet nuget push Nugets/EstateManagement.Contract.DomainEvents.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.MYGET_APIKEY }} --source https://www.myget.org/F/transactionprocessing/api/v2/package

.github/workflows/pullrequest.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and Test Pull Requests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
name: "Build and Test Pull Requests"
11+
env:
12+
ASPNETCORE_ENVIRONMENT: "Production"
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2.3.4
18+
19+
- name: Restore Nuget Packages
20+
run: dotnet restore FileProcessor.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json
21+
22+
- name: Build Code
23+
run: dotnet build FileProcessor.sln --configuration Release
24+
25+
- name: Run Unit Tests
26+
run: |
27+
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
28+
dotnet test "FileProcessor.BusinessLogic.Tests\FileProcessor.BusinessLogic.Tests.csproj"
29+
30+
#dotnet test "EstateManagement.EstateAggregate.Tests\EstateManagement.EstateAggregate.Tests.csproj"
31+
#dotnet test "EstateManagement.MerchantAggregate.Tests\EstateManagement.MerchantAggregate.Tests.csproj"
32+
#dotnet test "EstateManagement.Tests\EstateManagement.Tests.csproj"
33+
34+
#- name: Build Docker Image
35+
# run: docker build . --file FileProcessor/Dockerfile --tag fileprocessor:latest
36+
37+
#- name: Run Integration Tests
38+
# run: dotnet test "EstateManagement.IntegrationTests\EstateManagement.IntegrationTests.csproj" --filter Category=PRTe st
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Release Management
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- main
8+
9+
jobs:
10+
update_draft_release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Drafts your next Release notes as Pull Requests are merged into "master"
14+
- uses: toolmantim/release-drafter@v5.12.1
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)