This repository was archived by the owner on May 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (98 loc) · 3.52 KB
/
ci.yml
File metadata and controls
117 lines (98 loc) · 3.52 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
106
107
108
109
110
111
112
113
114
115
116
117
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Service commons for relational databases
on:
push:
branches: "**"
jobs:
# Disabled while Ultimate license bought
# analyze:
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Qodana Scan
# uses: JetBrains/qodana-action@v2023.2
# env:
# QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
build_and_test:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: |
dotnet nuget add source --username ${{ vars.PACKAGE_REGISTRY_USER }} --password ${{ secrets.PACKAGE_REGISTRY_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/wirewaste/index.json"
dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build --verbosity normal -c Release
publish_to_github_packages:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Pack
run: dotnet pack ServiceCommonsRelationalDatabase/ServiceCommonsRelationalDatabase.csproj -c Release
- name: Publish to GitHub packages
run: dotnet nuget push ServiceCommonsRelationalDatabase/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/wirewaste/index.json"
needs: [ build_and_test ]
create_release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
repository-projects: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read .csproj Version
id: version
run: |
sudo apt-get update
sudo apt-get install -y xmlstarlet
version=$(xmlstarlet sel -t -v "/Project/PropertyGroup/Version" ServiceCommonsRelationalDatabase/ServiceCommonsRelationalDatabase.csproj)
echo "version=$version" >> $GITHUB_OUTPUT
- uses: rickstaa/action-create-tag@v1
id: "tag_create"
with:
tag: ${{ steps.version.outputs.version }}
tag_exists_error: false
message: ${{ steps.version.outputs.version }}
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.version.outputs.version }}
excludeTypes: other
writeToFile: false
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: ${{ steps.version.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
needs: publish_to_github_packages