forked from Azure-Samples/dotnet-core-api
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.79 KB
/
ci.yaml
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
name: Dotnetapplication
on:
workflow_dispatch:
# push:
# branches:
# - master
# jobs: jobname--> steps: - name: change directory working-directory: ./<foldername>, so in upcoming steps you don't need to switch directory.
jobs:
DotnetInstall:
name: Run dotnet on Ubuntu
runs-on: self-hosted
steps:
- name: install dotnet using CLI way
run: |
wget https://download.visualstudio.microsoft.com/download/pr/b521d7d2-108b-43d9-861a-58b2505a125a/0023553690a68328b33bc30a38f151db/dotnet-sdk-6.0.420-linux-x64.tar.gz
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-6.0.420-linux-x64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
dotnet --version
Install_dependencies:
runs-on: self-hosted
needs: DotnetInstall
steps:
- name: Installing dependency
run: dotnet restore
Build_dotnet:
runs-on: self-hosted
needs: Install_dependencies
steps:
- name: Installing dependency
run: dotnet build --configuration Release
Publish_dotnet:
runs-on: self-hosted
needs: Build_dotnet
steps:
- name: Installing dependency
run: dotnet publish --configuration Release
- name: UploadArtifact
uses: actions/upload-artifact@v4.3.1
with:
name: dotnetdll
path: bin/Release/netcoreapp3.1/TodoApi.dll
Build_image:
runs-on: self-hosted
needs: Publish_dotnet
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Dll file
run: gh run download ${{ github.run_id }}
- name: Build Docker image
run: |
docker build -t demodotnet:${{ github.run_id }} .