-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (106 loc) · 2.82 KB
/
BuildTestDeploy.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: BuildTestDeploy
on:
workflow_dispatch:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- 'main'
paths-ignore:
- '.editorconfig'
- '.gitattributes'
- '.gitignore'
- '.runsettings'
- 'LICENSE.txt'
- 'README.md'
pull_request:
branches:
- 'main'
paths-ignore:
- '.editorconfig'
- '.gitattributes'
- '.gitignore'
- '.runsettings'
- 'LICENSE.txt'
- 'README.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
Target: PlcInterface.sln
jobs:
call-build-test:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
fail-fast: true
runs-on: ${{ matrix.os }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
steps:
- name: Sanitize windows paths
if: runner.os == 'Windows'
run: |
chcp 65001 #set code page to utf-8
$target = $env:Target.Replace('/', '\')
echo ("Target=" + $target) >> $env:GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Setup github remotes
if: env.GITHUB_PAT != ''
run: >
dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
--username ${{ github.repository_owner }}
--password ${{ secrets.GITHUB_PAT }}
--store-password-in-clear-text
--name github
- name: Install dependencies
run: >
dotnet restore ${{ env.Target }}
/p:EnableWindowsTargeting=true
- name: Build
run: >
dotnet build ${{ env.Target }}
--configuration Release
--no-restore
/p:EnableWindowsTargeting=true
- name: Test
run: >
dotnet test ${{ env.Target }}
--configuration Release
--verbosity normal
--no-build
--nologo
/p:EnableWindowsTargeting=true
call-deploy:
needs: call-build-test
permissions:
packages: write
uses: Vectron/GithubWorkflows/.github/workflows/DeployNugetGithub.yml@main
with:
os: ubuntu-latest
dotnet_version: |
6.0.x
7.0.x
8.0.x
solution_file: PlcInterface.sln
secrets:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
call-release:
needs: call-build-test
permissions:
deployments: write
contents: write
uses: Vectron/GithubWorkflows/.github/workflows/CreateRelease.yml@main