-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (61 loc) · 1.79 KB
/
build-test-pack.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
name: .NET CI Build, Test, and Publish
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
# Build and test libraries based on changes
build_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2 # Fetch two commits for proper diff
- name: Set up .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.x'
- name: Identify changed libraries
run: |
chmod +x ./scripts/identify-changed-libraries.sh
./scripts/identify-changed-libraries.sh
- name: Build and test libraries
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
chmod +x ./scripts/build-and-test.sh
./scripts/build-and-test.sh
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: TestResults
path: src/*/TestResults/
# Publish packages after build and test pass
publish:
if: github.ref == 'refs/heads/dev'
needs: build_test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.x'
- name: Decode and save certificate
run: |
echo "${{ secrets.CERTIFICATE_BASE64 }}" | base64 --decode > certificate.cer
echo "${{ secrets.PRIVATE_KEY_BASE64 }}" | base64 --decode > privatekey.pem
- name: Publish packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
CERTIFICATE_PATH: certificate.cer
PRIVATE_KEY_PATH: privatekey.pem
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |
chmod +x ./scripts/pack-all.sh
./scripts/pack-all.sh