1 Answer
- Newest
- Most votes
- Most comments
0
Here is the new code I have written for the same, but still the same issue persists. Any idea:
name: "Deploying a CI/CD for Windows Service using GitHub Actions"
on:
workflow_dispatch:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: cmd
steps:
- name: Checkout code repository
uses: actions/checkout@v3
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
- name: Restore Packages
run: nuget restore WindowsServiceDemo.sln
- name: Build solution
run: msbuild WindowsServiceDemo.sln /p:Configuration=Release /p:DeployOnBuild=true
deploy:
needs: build
runs-on: [ self-hosted, Windows, X64 ]
defaults:
run:
shell: cmd
steps:
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Install a service using Powershell
shell: powershell
run: Start-Process powershell -ArgumentList 'New-Service -Name "WinServDemo" -BinaryPathName "D:\a\WindowsServiceDemo\WindowsServiceDemo\WindowsServiceDemo\bin\Release\WindowsServiceDemo.exe"' -Verb RunAs
- name: Start a service using Poweshell
shell: powershell
run: Start-Process powershell -ArgumentList 'Start-Service -Name "WinServDemo"' -Verb RunAs
- name: Display the service status
shell: powershell
run: Start-Process powershell Get-Service -Verb RunAs
The build
job is running on GitHub self-hosted runner and the deploy
job is running on EC2 Windows instance as self-hosted runner. The instance type is t2.micro
using Base Windows Image 2022
.
answered a year ago
Relevant content
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 5 months ago