-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 2.74 KB
/
backend-ci.yml
File metadata and controls
105 lines (90 loc) · 2.74 KB
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
name: "Backend CI - placeholder"
on:
workflow_dispatch:
push:
branches:
- dev
tags:
- "v*"
paths:
- "src/backend/**"
- "tests/backend/**"
pull_request:
branches:
- main
- test
- dev
paths:
- "src/backend/**"
- "tests/backend/**"
- ".github/workflows/backend-ci.yml"
types: [opened, reopened, labeled, synchronize, ready_for_review]
# Sets permissions of the GITHUB_TOKEN to allow creating checks and updating PR
permissions:
contents: read
checks: write
pull-requests: write
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
env:
DOTNET_VERSION: "7.0.x"
BACKEND_SOLUTION_PATH: "src/backend"
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false }}
defaults:
run:
working-directory: ${{ env.BACKEND_SOLUTION_PATH }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # used by GitVersion to find the most recent tag outside of this branch
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/cache@v4
id: nuget-cache
with:
path: ~/.nuget/packages
key: nuget-${{ hashFiles('**/packages.lock.json') }}
- name: dotnet restore
run: dotnet restore --locked-mode
- name: dotnet build
run: dotnet build -c Release --no-restore
deploy:
# if: contains(github.ref, inputs.repo_name)
if: ${{ contains(github.ref, 'main') || startsWith(github.ref, 'refs/tags/v') }}
needs: [build]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.BACKEND_SOLUTION_PATH }}
# environment: ${{ inputs.deploy_target }}
environment: "prod"
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # used by GitVersion to find the most recent tag outside of this branch
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/cache@v4
id: nuget-cache
with:
path: ~/.nuget/packages
key: nuget-${{ hashFiles('**/packages.lock.json') }}
- name: dotnet restore
run: dotnet restore --locked-mode
- name: dotnet build
run: |
dotnet build -c Release --no-restore
# To see the version we would have deployed:
dotnet tool install --global GitVersion.Tool
dotnet gitversion