-
-
Notifications
You must be signed in to change notification settings - Fork 18
56 lines (53 loc) · 1.78 KB
/
ci-cd.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
name: CI/CD
on:
push:
branches:
- "**"
paths:
- .github/workflows/ci-cd.yml
- src/**
- scripts/**
- test/**
- Directory.Build.props
tags:
- "**"
workflow_dispatch:
permissions:
contents: write # Needed to create a GitHub Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Build
- run: dotnet build --configuration Release
# Test
- run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage"
env:
AWS_REGION: eu-west-1
AWS_USER_WITH_PERMISSIONS_ACCESS_KEY_ID: ${{ secrets.AWS_USER_WITH_PERMISSIONS_ACCESS_KEY_ID }}
AWS_USER_WITH_PERMISSIONS_SECRET_ACCESS_KEY: ${{ secrets.AWS_USER_WITH_PERMISSIONS_SECRET_ACCESS_KEY }}
AWS_USER_WITHOUT_PERMISSIONS_ACCESS_KEY_ID: ${{ secrets.AWS_USER_WITHOUT_PERMISSIONS_ACCESS_KEY_ID }}
AWS_USER_WITHOUT_PERMISSIONS_SECRET_ACCESS_KEY: ${{ secrets.AWS_USER_WITHOUT_PERMISSIONS_SECRET_ACCESS_KEY }}
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
AWS_API_GATEWAY_URL: ${{ secrets.AWS_API_GATEWAY_URL }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_S3_BUCKET_URL: ${{ secrets.AWS_S3_BUCKET_URL }}
- uses: codecov/codecov-action@v3
# Pack
- run: dotnet pack --configuration Release --no-build
- run: |
mkdir dist
mv src/bin/Release/*.nupkg ./dist
mv src/bin/Release/*.snupkg ./dist
# Release
- run: |
pushd ./scripts
npm ci
npm run release
popd
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: dotnet nuget push ./dist/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }}
if: startsWith(github.ref, 'refs/tags/')