Skip to content

Merge pull request #811 from TransactionProcessing/task/#810_recover_… #158

Merge pull request #811 from TransactionProcessing/task/#810_recover_…

Merge pull request #811 from TransactionProcessing/task/#810_recover_… #158

Workflow file for this run

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 Nugets 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 FileProcessor.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
- name: Build Code
run: dotnet build FileProcessor.sln --configuration Release
- 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 "FileProcessor.File.DomainEvents\FileProcessor.File.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
dotnet nuget push Nugets/FileProcessor.File.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
dotnet pack "FileProcessor.FileImportLog.DomainEvents\FileProcessor.FileImportLog.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
dotnet nuget push Nugets/FileProcessor.FileImportLog.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
dotnet pack "FileProcessor.FileProfile.DomainEvents\FileProcessor.FileProfile.DomainEvents.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
dotnet nuget push Nugets/FileProcessor.FileProfile.DomainEvents.${{ steps.next_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }}
dotnet pack "FileProcessor.Client\FileProcessor.Client.csproj" /p:PackageVersion=${{ steps.next_version.outputs.VERSION }} --output Nugets -c Release
dotnet nuget push Nugets/FileProcessor.Client.${{ 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 FileProcessor/Dockerfile --tag stuartferguson/fileprocessor:master
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/fileprocessor:master
- name: Publish API
run: |
dotnet publish "FileProcessor\FileProcessor.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained false \
-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/FileProcessor/FileProcessor/publishOutput
zip -r ../fileprocessor.zip ./*
- name: Upload the artifact
uses: actions/upload-artifact@v4.4.0
with:
name: fileprocessor
path: fileprocessor.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: fileprocessor
- name: Remove existing Windows service
run: |
$serviceName = "Transaction Processing - File Processor"
# 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 fileprocessor.zip -DestinationPath "C:\txnproc\transactionprocessing\fileprocessor" -Force
- name: Install as a Windows service
run: |
$serviceName = "Transaction Processing - File Processor"
$servicePath = "C:\txnproc\transactionprocessing\fileprocessor\FileProcessor.exe"
New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic
Start-Service -Name $serviceName