-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (69 loc) · 3.19 KB
/
post-integration.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
name: "Post-Integration"
on:
push:
branches:
- main
- '!stable'
- '!release'
env:
ATC_EMAIL: '[email protected]'
ATC_NAME: 'Atc-Net'
NUGET_REPO_URL: 'https://nuget.pkg.github.com/atc-net/index.json'
jobs:
merge-to-stable:
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_WORKFLOWS }}
- name: ⚛️ Sets environment variables - branch-name
uses: nelonoel/[email protected]
- name: ⚛️ Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: ⚙️ Setup dotnet 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: ⚙️ Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: 🧹 Clean
run: dotnet clean -c Release && dotnet nuget locals all --clear
- name: 🔁 Restore packages
run: dotnet restore
- name: 🛠️ Build
run: dotnet build -c Release --no-restore /p:UseSourceLink=true
- name: 🧪 Run unit tests
run: dotnet test -c Release --no-build --filter "Category!=Integration"
- name: 🌩️ SonarCloud install scanner
run: dotnet tool install --global dotnet-sonarscanner
- name: 🌩️ SonarCloud analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: pwsh
run: |
dotnet sonarscanner begin /k:"atc-net_atc-azure-iot" /o:"atc-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build -c Release /p:UseSourceLink=true --no-restore
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
- name: ⏩ Merge to stable-branch
run: |
git config --local user.email ${{ env.ATC_EMAIL }}
git config --local user.name ${{ env.ATC_NAME }}
git checkout stable
git merge --ff-only main
git push origin stable
- name: 🗳️ Creating library package for pre-release
run: dotnet pack -c Release --no-restore -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH_NAME
- name: 📦 Push packages to GitHub Package Registry
run: |
dotnet nuget push ${GITHUB_WORKSPACE}/packages/'Atc.Azure.IoT.'${NBGV_NuGetPackageVersion}'.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate
dotnet nuget push ${GITHUB_WORKSPACE}/packages/'Atc.Azure.IoTEdge.'${NBGV_NuGetPackageVersion}'.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate
dotnet nuget push ${GITHUB_WORKSPACE}/packages/'Atc.Azure.IoTEdge.DeviceEmulator.'${NBGV_NuGetPackageVersion}'.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate
dotnet nuget push ${GITHUB_WORKSPACE}/packages/'atc-azure-iot.'${NBGV_NuGetPackageVersion}'.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate