Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,911 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Microsoft, I have deployed a windows service using CI/CD pipeline through GitHub Actions. The runner is self-hosted runner configured on Amazon EC2 instance. The weird part is the commands are working fine but the service name is not showing in services.msc
console even after I did a lot of refresh but when I am doing it manually in the EC2 instance it is working absolutely fine. The instance size is t2.micro and the AMI is jammy 2022 Base Image.
What could be the potential reasons for this:
Here is the CI/CD code:
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