-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (53 loc) · 2.41 KB
/
build-and-deploy-all-environments.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
name: 'Build, Deploy (all environments)'
on:
workflow_dispatch:
push:
branches:
- '*'
concurrency: ${{ github.workflow }} # Prevents more than one instance of this workflow running at the same time
jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
- name: 'Install dotnet 8.0.x'
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
cache: true # Cache/restore nuget dependencies
- name: 'Install .Net (nuget) dependencies'
run: |
dotnet restore GenderPayGap.Core/GenderPayGap.Core.csproj
dotnet restore GenderPayGap.Database/GenderPayGap.Database.csproj
dotnet restore GenderPayGap.WebUI/GenderPayGap.WebUI.csproj
dotnet restore GenderPayGap.UnitTests/GenderPayGap.WebUI.Tests/GenderPayGap.WebUI.Tests.csproj
- name: 'Install Node.JS version 20 (v22 caused an error during npm ci)'
uses: actions/setup-node@v4
with:
node-version: 20
- name: 'Install Node.JS (npm) dependencies'
run: |
npm ci
working-directory: GenderPayGap.WebUI
- name: 'Build JS and SCSS code'
run: |
npm run build
working-directory: GenderPayGap.WebUI
- name: 'Save build run info to JSON file'
run: |
echo '{ "BuildNumber": "${{ github.run_id }}", "git_commit": "${{ github.sha }}", "git_branch": "${{ github.ref_name }}", "github_action_name": "${{ github.workflow }}", "github_action_run_url": "https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}" }' > build-number.json
working-directory: GenderPayGap.WebUI
- name: 'Build .Net code'
run: |
dotnet build GenderPayGap.WebUI/GenderPayGap.WebUI.csproj
- name: 'Test .Net code'
run: |
dotnet test GenderPayGap.UnitTests/GenderPayGap.WebUI.Tests/GenderPayGap.WebUI.Tests.csproj --logger trx --results-directory test-results
- name: 'Upload .Net test results'
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results
if: ${{ always() }} # Use always() to always run this step to publish test results when there are test failures