|
1 | | -# name: Publish |
2 | | - |
3 | | -# on: |
4 | | -# pull_request: |
5 | | -# push: |
6 | | -# branches: |
7 | | -# - master |
8 | | -# tags: |
9 | | -# - v* |
10 | | -# workflow_dispatch: |
11 | | -# inputs: |
12 | | -# ref: |
13 | | -# description: "Git reference (branch, tag, or commit SHA)" |
14 | | -# required: true |
15 | | -# default: "master" |
16 | | -# dry_run: |
17 | | -# description: "Dry run" |
18 | | -# required: true |
19 | | -# type: boolean |
20 | | -# default: true |
21 | | -# version: |
22 | | -# description: "Version number" |
23 | | -# required: false |
24 | | -# default: "" |
25 | | - |
26 | | -# jobs: |
27 | | -# vulnerability-scan: |
28 | | -# timeout-minutes: 10 |
29 | | -# strategy: |
30 | | -# fail-fast: false |
31 | | -# matrix: |
32 | | -# framework: [net8.0, net9.0] |
33 | | -# os: [ubuntu-latest, windows-latest] |
34 | | -# runs-on: ${{ matrix.os }} |
35 | | -# name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }} |
36 | | -# steps: |
37 | | -# - name: Checkout |
38 | | -# uses: actions/checkout@v3 |
39 | | -# with: |
40 | | -# ref: ${{ github.event.inputs.ref || github.ref }} |
41 | | -# - name: Install dotnet SDKs |
42 | | -# uses: actions/setup-dotnet@v3 |
43 | | -# with: |
44 | | -# dotnet-version: | |
45 | | -# 8.0.x |
46 | | -# 9.0.x |
47 | | -# - name: Scan for Vulnerabilities |
48 | | -# shell: bash |
49 | | -# run: | |
50 | | -# dotnet nuget list source |
51 | | -# dotnet restore ./src/KurrentDB.Client/KurrentDB.Client.csproj |
52 | | -# dotnet restore ./test/KurrentDB.Client.Tests/KurrentDB.Client.Tests.csproj |
53 | | -# dotnet list package --vulnerable --include-transitive --framework ${{ matrix.framework }} | tee vulnerabilities.txt |
54 | | -# ! cat vulnerabilities.txt | grep -q "has the following vulnerable packages" |
55 | | - |
56 | | -# build-samples: |
57 | | -# timeout-minutes: 5 |
58 | | -# name: build-samples/${{ matrix.framework }} |
59 | | -# runs-on: ubuntu-latest |
60 | | -# strategy: |
61 | | -# fail-fast: false |
62 | | -# matrix: |
63 | | -# framework: [net8.0, net9.0] |
64 | | -# services: |
65 | | -# esdb: |
66 | | -# image: docker.kurrent.io/eventstore/eventstoredb-ee:lts |
67 | | -# env: |
68 | | -# EVENTSTORE_INSECURE: true |
69 | | -# EVENTSTORE_MEM_DB: false |
70 | | -# EVENTSTORE_RUN_PROJECTIONS: all |
71 | | -# EVENTSTORE_START_STANDARD_PROJECTIONS: true |
72 | | -# ports: |
73 | | -# - 2113:2113 |
74 | | -# options: --health-cmd "exit 0" |
75 | | -# steps: |
76 | | -# - name: Checkout |
77 | | -# uses: actions/checkout@v3 |
78 | | -# with: |
79 | | -# ref: ${{ github.event.inputs.ref || github.ref }} |
80 | | -# - name: Install dotnet SDKs |
81 | | -# uses: actions/setup-dotnet@v3 |
82 | | -# with: |
83 | | -# dotnet-version: | |
84 | | -# 8.0.x |
85 | | -# 9.0.x |
86 | | -# - name: Compile |
87 | | -# shell: bash |
88 | | -# run: | |
89 | | -# dotnet build samples |
90 | | -# - name: Run |
91 | | -# shell: bash |
92 | | -# run: | |
93 | | -# find samples/ -type f -iname "*.csproj" -print0 | xargs -0L1 dotnet run --framework ${{ matrix.framework }} --project |
94 | | - |
95 | | -# generate-certificates: |
96 | | -# runs-on: ubuntu-latest |
97 | | -# steps: |
98 | | -# - name: Checkout code |
99 | | -# uses: actions/checkout@v4 |
100 | | -# - name: Generate certificates |
101 | | -# run: | |
102 | | -# mkdir -p certs |
103 | | -# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.kurrent.io/eventstore-utils/es-gencert-cli:latest create-ca -out /tmp/ca |
104 | | -# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.kurrent.io/eventstore-utils/es-gencert-cli:latest create-node -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/node -ip-addresses 127.0.0.1 -dns-names localhost |
105 | | -# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.kurrent.io/eventstore-utils/es-gencert-cli:latest create-user -username admin -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/user-admin |
106 | | -# docker run --rm --user root --volume "$PWD/certs:/tmp" docker.kurrent.io/eventstore-utils/es-gencert-cli:latest create-user -username invalid -ca-certificate /tmp/ca/ca.crt -ca-key /tmp/ca/ca.key -out /tmp/user-invalid |
107 | | -# - name: Set permissions on certificates |
108 | | -# run: | |
109 | | -# sudo chown -R $USER:$USER certs |
110 | | -# sudo chmod -R 755 certs |
111 | | -# - name: Upload certificates |
112 | | -# uses: actions/upload-artifact@v4 |
113 | | -# with: |
114 | | -# name: certs |
115 | | -# path: certs |
116 | | - |
117 | | -# test: |
118 | | -# needs: generate-certificates |
119 | | -# timeout-minutes: 10 |
120 | | -# strategy: |
121 | | -# fail-fast: false |
122 | | -# matrix: |
123 | | -# framework: [net8.0, net9.0] |
124 | | -# os: [ubuntu-latest] |
125 | | -# configuration: [release] |
126 | | -# test: |
127 | | -# [ |
128 | | -# Streams, |
129 | | -# PersistentSubscriptions, |
130 | | -# Operations, |
131 | | -# ProjectionManagement, |
132 | | -# UserManagement, |
133 | | -# Security, |
134 | | -# Misc, |
135 | | -# ] |
136 | | -# runs-on: ${{ matrix.os }} |
137 | | -# name: ${{ matrix.test }} (${{ matrix.os }}, ${{ matrix.framework }}) |
138 | | -# steps: |
139 | | -# - name: Checkout |
140 | | -# uses: actions/checkout@v3 |
141 | | -# with: |
142 | | -# ref: ${{ github.event.inputs.ref || github.ref }} |
143 | | -# - name: Login to Cloudsmith |
144 | | -# uses: docker/login-action@v3 |
145 | | -# with: |
146 | | -# registry: docker.kurrent.io |
147 | | -# username: ${{ secrets.CLOUDSMITH_CICD_USER }} |
148 | | -# password: ${{ secrets.CLOUDSMITH_CICD_TOKEN }} |
149 | | -# - name: Pull EventStore Image |
150 | | -# shell: bash |
151 | | -# run: | |
152 | | -# docker pull docker.kurrent.io/eventstore-ce/eventstoredb-ce:ci |
153 | | -# - shell: bash |
154 | | -# run: | |
155 | | -# git fetch --prune --unshallow |
156 | | -# - name: Install dotnet SDKs |
157 | | -# uses: actions/setup-dotnet@v3 |
158 | | -# with: |
159 | | -# dotnet-version: | |
160 | | -# 8.0.x |
161 | | -# 9.0.x |
162 | | -# - name: Compile |
163 | | -# shell: bash |
164 | | -# run: | |
165 | | -# dotnet build --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} src/KurrentDB.Client |
166 | | -# - name: Download certificates |
167 | | -# uses: actions/download-artifact@v4 |
168 | | -# with: |
169 | | -# name: certs |
170 | | -# path: certs |
171 | | -# - name: Run Tests (Linux) |
172 | | -# if: runner.os == 'Linux' |
173 | | -# shell: bash |
174 | | -# env: |
175 | | -# ES_DOCKER_TAG: ci |
176 | | -# ES_DOCKER_REGISTRY: docker.kurrent.io/eventstore-ce/eventstoredb-ce |
177 | | -# run: | |
178 | | -# dotnet test --configuration ${{ matrix.configuration }} --blame \ |
179 | | -# --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" \ |
180 | | -# --framework ${{ matrix.framework }} \ |
181 | | -# --filter "Category=Target:${{ matrix.test }}" \ |
182 | | -# test/KurrentDB.Client.Tests |
183 | | -# - name: Run Tests (Windows) |
184 | | -# if: runner.os == 'Windows' |
185 | | -# shell: pwsh |
186 | | -# env: |
187 | | -# ES_DOCKER_TAG: ci |
188 | | -# ES_DOCKER_REGISTRY: docker.kurrent.io/eventstore-ce/eventstoredb-ce |
189 | | -# run: | |
190 | | -# dotnet test --configuration ${{ matrix.configuration }} --blame ` |
191 | | -# --logger:"GitHubActions;report-warnings=false" --logger:"console;verbosity=normal" ` |
192 | | -# --framework ${{ matrix.framework }} ` |
193 | | -# --filter "Category=Target:${{ matrix.test }}" ` |
194 | | -# test/KurrentDB.Client.Tests |
195 | | - |
196 | | -# publish: |
197 | | -# timeout-minutes: 5 |
198 | | -# needs: [vulnerability-scan, test, build-samples] |
199 | | -# runs-on: ubuntu-latest |
200 | | -# name: publish |
201 | | -# steps: |
202 | | -# - name: Checkout |
203 | | -# uses: actions/checkout@v3 |
204 | | -# with: |
205 | | -# ref: ${{ github.event.inputs.ref || github.ref }} |
206 | | -# fetch-depth: 0 |
207 | | - |
208 | | -# - name: Get Version |
209 | | -# id: get_version |
210 | | -# run: | |
211 | | -# echo "branch=${GITHUB_REF:10}" >> $GITHUB_OUTPUT |
212 | | -# dotnet nuget list source |
213 | | -# dotnet tool restore |
214 | | - |
215 | | -# if [ -n "${{ github.event.inputs.version }}" ]; then |
216 | | -# version="${{ github.event.inputs.version }}" |
217 | | -# else |
218 | | -# version=$(dotnet tool run minver -- --tag-prefix=v) |
219 | | -# fi |
220 | | - |
221 | | -# echo "version=${version}" >> $GITHUB_OUTPUT |
222 | | - |
223 | | -# - name: Install dotnet SDKs |
224 | | -# uses: actions/setup-dotnet@v3 |
225 | | -# with: |
226 | | -# dotnet-version: | |
227 | | -# 8.0.x |
228 | | -# 9.0.x |
229 | | - |
230 | | -# - name: Dotnet Pack |
231 | | -# shell: bash |
232 | | -# run: | |
233 | | -# echo "version=${{ steps.get_version.outputs.version }}" |
234 | | -# mkdir -p packages |
235 | | - |
236 | | -# extra_minver_flag="" |
237 | | -# if [ -n "${{ github.event.inputs.version }}" ]; then |
238 | | -# extra_minver_flag="/p:MinVerSkip=true" |
239 | | -# fi |
240 | | - |
241 | | -# dotnet pack /p:Version=${{ steps.get_version.outputs.version }} $extra_minver_flag \ |
242 | | -# --configuration=Release \ |
243 | | -# /p:PublishDir=./packages \ |
244 | | -# /p:NoWarn=NU5105 \ |
245 | | -# /p:RepositoryUrl=https://github.com/kurrent-io/EventStore-Client-Dotnet \ |
246 | | -# /p:RepositoryType=git |
247 | | - |
248 | | -# - name: Publish Artifacts |
249 | | -# uses: actions/upload-artifact@v4 |
250 | | -# with: |
251 | | -# path: packages |
252 | | -# name: nuget-packages |
253 | | - |
254 | | -# - name: Dotnet Push to Github Packages |
255 | | -# shell: bash |
256 | | -# if: github.event.inputs.dry_run != 'true' || github.event_name == 'push' |
257 | | -# run: | |
258 | | -# dotnet tool restore |
259 | | -# find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/kurrent-io/index.json --skip-duplicate |
260 | | - |
261 | | -# - name: Dotnet Push to Nuget.org |
262 | | -# shell: bash |
263 | | -# if: github.event.inputs.dry_run != 'true' || github.event_name == 'push' |
264 | | -# run: | |
265 | | -# dotnet nuget list source |
266 | | -# dotnet tool restore |
267 | | -# find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.KURRENT_NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v* |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + ref: |
| 10 | + description: "Git reference (branch, tag, or commit SHA)" |
| 11 | + required: true |
| 12 | + default: "master" |
| 13 | + dry_run: |
| 14 | + description: "Dry run" |
| 15 | + required: true |
| 16 | + type: boolean |
| 17 | + default: true |
| 18 | + version: |
| 19 | + description: "Version number" |
| 20 | + required: false |
| 21 | + default: "" |
| 22 | + |
| 23 | +jobs: |
| 24 | + vulnerability-scan: |
| 25 | + timeout-minutes: 10 |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + framework: [net8.0, net9.0] |
| 30 | + os: [ubuntu-latest, windows-latest] |
| 31 | + runs-on: ${{ matrix.os }} |
| 32 | + name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }} |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v3 |
| 36 | + with: |
| 37 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 38 | + - name: Install dotnet SDKs |
| 39 | + uses: actions/setup-dotnet@v3 |
| 40 | + with: |
| 41 | + dotnet-version: | |
| 42 | + 8.0.x |
| 43 | + 9.0.x |
| 44 | + - name: Scan for Vulnerabilities |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + dotnet nuget list source |
| 48 | + dotnet restore ./src/KurrentDB.Client/KurrentDB.Client.csproj |
| 49 | + dotnet restore ./test/KurrentDB.Client.Tests/KurrentDB.Client.Tests.csproj |
| 50 | + dotnet list package --vulnerable --include-transitive --framework ${{ matrix.framework }} | tee vulnerabilities.txt |
| 51 | + ! cat vulnerabilities.txt | grep -q "has the following vulnerable packages" |
| 52 | +
|
| 53 | + publish: |
| 54 | + timeout-minutes: 5 |
| 55 | + needs: [vulnerability-scan] |
| 56 | + runs-on: ubuntu-latest |
| 57 | + name: publish |
| 58 | + steps: |
| 59 | + - name: Checkout |
| 60 | + uses: actions/checkout@v3 |
| 61 | + with: |
| 62 | + ref: ${{ github.event.inputs.ref || github.ref }} |
| 63 | + fetch-depth: 0 |
| 64 | + |
| 65 | + - name: Get Version |
| 66 | + id: get_version |
| 67 | + run: | |
| 68 | + echo "branch=${GITHUB_REF:10}" >> $GITHUB_OUTPUT |
| 69 | + dotnet nuget list source |
| 70 | + dotnet tool restore |
| 71 | +
|
| 72 | + if [ -n "${{ github.event.inputs.version }}" ]; then |
| 73 | + version="${{ github.event.inputs.version }}" |
| 74 | + else |
| 75 | + version=$(dotnet tool run minver -- --tag-prefix=v) |
| 76 | + fi |
| 77 | +
|
| 78 | + echo "version=${version}" >> $GITHUB_OUTPUT |
| 79 | +
|
| 80 | + - name: Install dotnet SDKs |
| 81 | + uses: actions/setup-dotnet@v3 |
| 82 | + with: |
| 83 | + dotnet-version: | |
| 84 | + 8.0.x |
| 85 | + 9.0.x |
| 86 | +
|
| 87 | + - name: Dotnet Pack |
| 88 | + shell: bash |
| 89 | + run: | |
| 90 | + echo "version=${{ steps.get_version.outputs.version }}" |
| 91 | + mkdir -p packages |
| 92 | +
|
| 93 | + extra_minver_flag="" |
| 94 | + if [ -n "${{ github.event.inputs.version }}" ]; then |
| 95 | + extra_minver_flag="/p:MinVerSkip=true" |
| 96 | + fi |
| 97 | +
|
| 98 | + dotnet pack /p:Version=${{ steps.get_version.outputs.version }} $extra_minver_flag \ |
| 99 | + --configuration=Release \ |
| 100 | + /p:PublishDir=./packages \ |
| 101 | + /p:NoWarn=NU5105 \ |
| 102 | + /p:RepositoryUrl=https://github.com/kurrent-io/KurrentDB-Client-Dotnet \ |
| 103 | + /p:RepositoryType=git |
| 104 | +
|
| 105 | + - name: Publish Artifacts |
| 106 | + uses: actions/upload-artifact@v4 |
| 107 | + with: |
| 108 | + path: packages |
| 109 | + name: nuget-packages |
| 110 | + |
| 111 | + - name: Dotnet Push to Github Packages |
| 112 | + shell: bash |
| 113 | + if: github.event.inputs.dry_run != 'true' || github.event_name == 'push' |
| 114 | + run: | |
| 115 | + dotnet tool restore |
| 116 | + find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/kurrent-io/index.json --skip-duplicate |
| 117 | +
|
| 118 | + - name: Dotnet Push to Nuget.org |
| 119 | + shell: bash |
| 120 | + if: github.event.inputs.dry_run != 'true' || github.event_name == 'push' |
| 121 | + run: | |
| 122 | + dotnet nuget list source |
| 123 | + dotnet tool restore |
| 124 | + find . -name "*.nupkg" | xargs -n1 dotnet nuget push --api-key=${{ secrets.KURRENT_NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |
0 commit comments