Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amauryval/422bc04686ebf589e5602d881dc35014 to your computer and use it in GitHub Desktop.
Save amauryval/422bc04686ebf589e5602d881dc35014 to your computer and use it in GitHub Desktop.
Need a linux hosted VM (ex. Ubuntu)
STEP 01. Add Following yml file (which is created by default - Git action template)
*******************************File Start*************************************
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: Build with dotnet
run: dotnet build --configuration Release
******************************File End********************************
STEP 02.
Create an user without sudo previladge. Don't add it in sudo group.
> adduser <username>
STEP 03.
> Go to repository/project settings
> Then Actions > Then click on add runner
> Follow the instructions
> At-last change the yml file line -> runs-on: self-hosted <- by default it is ubuntu
STEP 04. To run created runner
> ./run.sh
STEP 05. To run as a service, you can create
> ./svc.sh
Bonus::
To get service running services
> systemctl --type=service --state=active
To stop a service
> systemctl stop <service-name>
To see how running service performing. <service-runner-name> can be get from previous command
> sudo journalctl -u <service-runner-name> --follow
Links to check:
https://www.youtube.com/watch?v=G6nBM3NxBDc&feature=emb_title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment