-
Notifications
You must be signed in to change notification settings - Fork 9
132 lines (125 loc) · 4.1 KB
/
dotnet.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: .NET
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
release:
types:
- published
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_FEED: https://api.nuget.org/v3/index.json
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.101"
- name: check format
run: dotnet format --severity error --verify-no-changes ./Motor.NET.sln
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Install dependencies
run: dotnet restore Motor.NET.sln
- name: Build
run: dotnet build --configuration Release --no-restore Motor.NET.sln
- name: Test
run: dotnet test --no-restore Motor.NET.sln
- name: Pack
run: dotnet pack -v minimal -c Release --no-restore -o ./artifacts Motor.NET.sln
- name: Publish Bridge
run: dotnet publish -v minimal -c Release --no-restore -o ./artifacts-bridge ./src/Motor.Extensions.Hosting.Bridge/Motor.Extensions.Hosting.Bridge.csproj
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: artifacts
path: |
./artifacts/*.nupkg
./artifacts/*.snupkg
- name: Upload Artifact Bridge
uses: actions/upload-artifact@v2
with:
name: artifacts-bridge
path: ./artifacts-bridge/*
#code-ql:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v1
# with:
# languages: csharp
# - name: Setup .NET
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: 7.0.x
# - name: Install dependencies
# run: dotnet restore Motor.NET.sln
# - name: Build
# run: dotnet build --configuration Release --no-restore Motor.NET.sln
# - name: Perform CodeQL Analysis
# uses: github/codeql-action/analyze@v1
deploy:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Push to NuGet Feed
run: dotnet nuget push './artifacts/*.nupkg' --skip-duplicate --source $NUGET_FEED --api-key $NUGET_KEY
build-bridge:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: artifacts-bridge
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/gdatasoftwareag/motornet/bridge
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${VERSION}-${GITHUB_SHA::8}"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Login to Github Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name == 'release' }}
context: ./artifacts-bridge
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}