Repository navigation
107 lines (88 loc) · 4.01 KB
/
Copy pathpushtomaster.yml
File metadata and controls
107 lines (88 loc) · 4.01 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
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
name: Publish Pre-Release Nuget and Docker
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
jobs:
build:
name: "Publish Pre-Release Nuget and Docker"
env:
ASPNETCORE_ENVIRONMENT: "Production"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Restore Nuget Packages
run: dotnet restore TransactionProcessorACL.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
- name: 'Get Previous tag'
id: get-latest-tag
uses: actions-ecosystem/action-get-latest-tag@v1
with:
semver_only: true
- name: 'Bump Version'
id: bump-semver
uses: actions-ecosystem/action-bump-semver@v1
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: patch
- name: Print Version
id: next_version
run: echo ::set-output name=VERSION::${{ steps.bump-semver.outputs.new_version }}.$GITHUB_RUN_NUMBER
- name: Build and Publish Nuget Packages
run: |
dotnet pack "TransactionProcessorACL.DataTransferObjects\TransactionProcessorACL.DataTransferObjects.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets
dotnet nuget push Nugets/TransactionProcessorACL.DataTransferObjects.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
- name: Publish Images to Docker Hub
run: |
docker build . --file TransactionProcessorACL/Dockerfile --tag stuartferguson/transactionprocessoracl:master
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/transactionprocessoracl:master
- name: Publish API
run: |
dotnet publish "TransactionProcessorACL\TransactionProcessorACL.csproj" \
--configuration Release \
--output publishOutput \
-r win-x64 \
--self-contained \
-p:Version=${{ steps.next_version.outputs.VERSION }} \
-p:AssemblyVersion=${{ steps.next_version.outputs.VERSION }} \
-p:FileVersion=${{ steps.next_version.outputs.VERSION }} \
-p:InformationalVersion=${{ steps.next_version.outputs.VERSION }}
- name: Build Release Package
run: |
cd /home/runner/work/TransactionProcessorACL/TransactionProcessorACL/publishOutput
zip -r ../transactionprocessoracl.zip ./*
- name: Upload the artifact
uses: actions/upload-artifact@v4.4.0
with:
name: transactionprocessoracl
path: transactionprocessoracl.zip
deploydevelopment:
runs-on: [developmentserver,windows]
needs: build
environment: development
name: "Deploy to Development"
steps:
- name: Download the artifact
uses: actions/download-artifact@v4.1.8
with:
name: transactionprocessoracl
- name: Remove existing Windows service
run: |
$serviceName = "Transaction Processing - Transaction Processor ACL"
# Check if the service exists
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
Stop-Service -Name $serviceName
sc.exe delete $serviceName
}
- name: Unzip the files
run: |
Expand-Archive -Path transactionprocessoracl.zip -DestinationPath "C:\txnproc\transactionprocessing\transactionprocessoracl" -Force
- name: Install as a Windows service
run: |
$serviceName = "Transaction Processing - Transaction Processor ACL"
$servicePath = "C:\txnproc\transactionprocessing\transactionprocessoracl\TransactionProcessorACL.exe"
New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic
Start-Service -Name $serviceName