-
Notifications
You must be signed in to change notification settings - Fork 2
636 lines (587 loc) · 23.9 KB
/
stage-5-publish.yaml
File metadata and controls
636 lines (587 loc) · 23.9 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
name: "Publish stage"
on:
workflow_call:
inputs:
build_datetime:
description: "Build datetime, set by the CI/CD pipeline workflow"
required: true
type: string
build_timestamp:
description: "Build timestamp, set by the CI/CD pipeline workflow"
required: true
type: string
build_epoch:
description: "Build epoch, set by the CI/CD pipeline workflow"
required: true
type: string
nodejs_version:
description: "Node.js version, set by the CI/CD pipeline workflow"
required: true
type: string
python_version:
description: "Python version, set by the CI/CD pipeline workflow"
required: true
type: string
terraform_version:
description: "Terraform version, set by the CI/CD pipeline workflow"
required: true
type: string
version:
description: "Version of the software, set by the CI/CD pipeline workflow"
required: true
type: string
is_version_prerelease:
description: "Is this a semantically versioned pre release, set by the CI/CD pipeline workflow"
required: true
type: string
jobs:
publish:
name: "Publish packages"
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
release_id: ${{ steps.create_release.outputs.id }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Get the artefacts 1"
uses: actions/download-artifact@v7
with:
path: ./artifacts/jekyll-docs-${{ inputs.version }}
name: jekyll-docs-${{ inputs.version }}
- name: "Get the artefacts 2"
uses: actions/download-artifact@v7
with:
path: ./artifacts/sdk-html-docs-${{ inputs.version }}
name: sdk-html-docs-${{ inputs.version }}
- name: "Get the artefacts 3"
uses: actions/download-artifact@v7
with:
path: ./artifacts/sdk-swagger-docs-${{ inputs.version }}
name: sdk-swagger-docs-${{ inputs.version }}
- name: "Get the artefacts 4"
uses: actions/download-artifact@v7
with:
path: ./artifacts/sdk-html-${{ inputs.version }}
name: sdk-html-${{ inputs.version }}
- name: "Get the artefacts 5"
uses: actions/download-artifact@v7
with:
path: ./artifacts/sdk-ts-${{ inputs.version }}
name: sdk-ts-${{ inputs.version }}
- name: "Get the artefacts 6"
uses: actions/download-artifact@v7
with:
path: ./artifacts/sdk-python-${{ inputs.version }}
name: sdk-python-${{ inputs.version }}
- name: "Get the artefacts 7"
uses: actions/download-artifact@v7
with:
path: ./artifacts/sdk-csharp-${{ inputs.version }}
name: sdk-csharp-${{ inputs.version }}
# Take out for now - might add again in the future
# - name: "Get the artefacts 9"
# uses: actions/download-artifact@v7
# with:
# path: ./artifacts/server-csharp-${{ inputs.version }}
# name: server-csharp-${{ inputs.version }}
- name: "Create release"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.version }}
release_name: ${{ inputs.version }}
body: |
Release of ${{ inputs.version }}
draft: false
prerelease: ${{ inputs.is_version_prerelease == 'true'}}
- name: "Upload jekyll docs release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/jekyll-docs-${{ inputs.version }}/artifact.tar
asset_name: jekyll-docs-${{ inputs.version }}.tar
asset_content_type: "application/gzip"
- name: "Upload sdk html docs release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/sdk-html-docs-${{ inputs.version }}/artifact.tar
asset_name: sdk-html-docs-${{ inputs.version }}.tar
asset_content_type: "application/gzip"
- name: "Upload sdk swagger docs release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/sdk-swagger-docs-${{ inputs.version }}/artifact.tar
asset_name: sdk-swagger-docs-${{ inputs.version }}.tar
asset_content_type: "application/gzip"
- name: "zip html release asset"
# GitHub pages needs a single tar called artifact inside the zip.
working-directory: ./artifacts/sdk-html-${{ inputs.version }}
run: zip -r ../sdk-html-${{ inputs.version }}.zip .
shell: bash
- name: "Upload sdk html release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/sdk-html-${{ inputs.version }}.zip
asset_name: sdk-html-${{ inputs.version }}.zip
asset_content_type: "application/gzip"
- name: "zip sdk ts release asset"
# GitHub pages needs a single tar called artifact inside the zip.
working-directory: ./artifacts/sdk-ts-${{ inputs.version }}
run: zip -r ../sdk-ts-${{ inputs.version }}.zip .
shell: bash
- name: "Upload sdk ts release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/sdk-ts-${{ inputs.version }}.zip
asset_name: sdk-ts-${{ inputs.version }}.zip
asset_content_type: "application/gzip"
- name: "zip sdk python release asset"
# GitHub pages needs a single tar called artifact inside the zip.
working-directory: ./artifacts/sdk-python-${{ inputs.version }}
run: zip -r ../sdk-python-${{ inputs.version }}.zip .
shell: bash
- name: "Upload sdk python release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/sdk-python-${{ inputs.version }}.zip
asset_name: sdk-python-${{ inputs.version }}.zip
asset_content_type: "application/gzip"
- name: "zip sdk csharp release asset"
# GitHub pages needs a single tar called artifact inside the zip.
working-directory: ./artifacts/sdk-csharp-${{ inputs.version }}
run: zip -r ../sdk-csharp-${{ inputs.version }}.zip .
shell: bash
- name: "Upload sdk csharp release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
asset_path: ./artifacts/sdk-csharp-${{ inputs.version }}.zip
asset_name: sdk-csharp-${{ inputs.version }}.zip
asset_content_type: "application/gzip"
# Take out for now - might add again in the future
# - name: "zip csharp server release asset"
# # GitHub pages needs a single tar called artifact inside the zip.
# working-directory: ./artifacts/server-csharp-${{ inputs.version }}
# run: zip -r ../server-csharp-${{ inputs.version }}.zip .
# shell: bash
# Take out for now - might add again in the future
# - name: "Upload csharp server release asset"
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: "${{ steps.create_release.outputs.upload_url }}"
# asset_path: ./artifacts/server-csharp-${{ inputs.version }}.zip
# asset_name: server-csharp-${{ inputs.version }}.zip
# asset_content_type: "application/gzip"
publish-oas-specs:
name: "Publish OAS spec (${{ matrix.apimEnv }})"
runs-on: ubuntu-latest
needs: [publish]
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for publishing release asset
timeout-minutes: 10
strategy:
matrix:
apimEnv: [internal-dev, int, ref, prod]
steps:
- name: "Download OAS spec artifact"
uses: actions/download-artifact@v7
with:
path: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
name: api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
- name: "Zip OAS specification"
working-directory: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}
run: zip -r ../api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip .
shell: bash
- name: "Upload OAS specification release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish.outputs.upload_url }}
asset_path: ./artifacts/api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip
asset_name: api-oas-specification-${{ matrix.apimEnv }}-${{ inputs.version }}.zip
asset_content_type: "application/zip"
# Take out for now - might add again in the future
# ### PUBLISH DOCKER - THIS NEEDS CHANGING TO DO THE DOCKER BUILD IN THE BUILD STAGE AND ARTIFACT IT. SEE publishlibhostdocker below how how and the buildlibs action.
# publishdocker:
# name: "Publish docker packages"
# runs-on: ubuntu-latest
# needs: [publish]
# permissions:
# packages: write
# contents: read
# steps:
# - name: "Get the artefacts csharp docker"
# uses: actions/download-artifact@v7
# with:
# path: .
# name: server-csharp-docker-${{ inputs.version }}
# - name: "Get the artefacts csharp server"
# uses: actions/download-artifact@v7
# with:
# path: ./csharp-server
# name: server-csharp-${{ inputs.version }}
# - run: ls -la
# - run: |
# docker build . -t ghcr.io/nhsdigital/nhsnotifysupplierserver:latest
# echo $CR_PAT | docker login ghcr.io -u nhs-notify-supplier-api --password-stdin
# docker push ghcr.io/nhsdigital/nhsnotifysupplierserver:latest
# env:
# CR_PAT: ${{ secrets.GITHUB_TOKEN }}
### PUBLISH NUGET
publishnuget:
name: "Publish nuget packages to nuget.pkg.github.com"
runs-on: ubuntu-latest
needs: [publish]
permissions:
packages: write
contents: read
steps:
- name: "Get the artefacts"
uses: actions/download-artifact@v7
with:
path: .
name: sdk-csharp-${{ inputs.version }}
- run: |
ls -la
- run: |
dotnet nuget add source \
--username nhs-notify-supplier-api \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--name github \
"https://nuget.pkg.github.com/NHSDigital/index.json"
- run: |
echo "ROOT .version file is: $(cat .version)"
echo "GH variable version is: ${{ inputs.version }}"
name: Showing the base versions
- run: |
VERSION=${{ inputs.version }}
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
echo $VERSION
echo $SHORT_VERSION
echo $NUGET_VERSION
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
echo $SHORT_NUGET_VERSION
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
echo $SHORTER_NUGET_VERSION
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
echo $TEST_NUGET_VERSION
echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
name: Set the nuget version
id: set-nuget-version
- run: |
dotnet nuget push \
nhsnotifysupplier.${TEST_NUGET_VERSION}.nupkg \
--source github \
--api-key $GITHUB_TOKEN
env:
TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
### Publish NPM
publishnpm:
name: "Publish npm packages to npm.pkg.github.com"
runs-on: ubuntu-latest
needs: [publish]
permissions:
packages: write
contents: read
steps:
- name: "Get the artefacts"
uses: actions/download-artifact@v7
with:
path: .
name: sdk-ts-${{ inputs.version }}
- uses: actions/setup-node@v6
with:
node-version: "24.3"
registry-url: "https://npm.pkg.github.com"
scope: "@NHSDigital"
- run: ls -la
- run: npm cache clear --force
- run: npm i
- run: npm run build
- run: ls -la
- run: npm publish --verbose --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
success:
name: "Success notification"
runs-on: ubuntu-latest
needs: [publish, publishnpm]
steps:
- name: "Check prerequisites for notification"
id: check
run: echo "secret_exist=${{ secrets.TEAMS_NOTIFICATION_WEBHOOK_URL != '' }}" >> $GITHUB_OUTPUT
- name: "Notify on publishing packages"
if: steps.check.outputs.secret_exist == 'true'
uses: nhs-england-tools/notify-msteams-action@v1.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
teams-webhook-url: ${{ secrets.TEAMS_NOTIFICATION_WEBHOOK_URL }}
message-title: "Notification title"
message-text: "This is a notification body"
link: ${{ github.event.pull_request.html_url }}
# Take out for now - might add again in the future
# ### PUBLISH LIBS ABSTRACTION NUGET
# publishlibsabstractionsnuget:
# name: "Publish libs abstractions packages to nuget.pkg.github.com"
# runs-on: ubuntu-latest
# needs: [publish]
# permissions:
# packages: write
# contents: read
# steps:
# - name: "Get the artefacts"
# uses: actions/download-artifact@v5
# with:
# path: .
# name: libs-abstractions-${{ inputs.version }}
# - run: |
# ls -la
# find . -name ".version"
# - run: |
# dotnet nuget add source \
# --username nhs-notify-supplier-api \
# --password ${{ secrets.GITHUB_TOKEN }} \
# --store-password-in-clear-text \
# --name github \
# "https://nuget.pkg.github.com/NHSDigital/index.json"
# - run: |
# echo "ROOT .version file is: $(cat .version)"
# echo "GH variable version is: ${{ inputs.version }}"
# name: Showing the base versions
# - run: |
# VERSION=${{ inputs.version }}
# SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
# NUGET_VERSION="$(echo "$VERSION" | tr + .)"
# echo $VERSION
# echo $SHORT_VERSION
# echo $NUGET_VERSION
# SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORT_NUGET_VERSION
# SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORTER_NUGET_VERSION
# TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# echo $TEST_NUGET_VERSION
# echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
# name: Set the nuget version
# id: set-nuget-version
# - run: |
# dotnet nuget push \
# nhs.notify.suppliers.api.abstractions.${TEST_NUGET_VERSION}.nupkg \
# --source github \
# --api-key $GITHUB_TOKEN
# env:
# TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ### PUBLISH LIBS LETTERS NUGET
# publishliblettersnuget:
# name: "Publish libs letter packages to nuget.pkg.github.com"
# runs-on: ubuntu-latest
# needs: [publish]
# permissions:
# packages: write
# contents: read
# steps:
# - name: "Get the artefacts"
# uses: actions/download-artifact@v7
# with:
# path: .
# name: libs-letter-${{ inputs.version }}
# - run: |
# ls -la
# find . -name ".version"
# - run: |
# dotnet nuget add source \
# --username nhs-notify-supplier-api \
# --password ${{ secrets.GITHUB_TOKEN }} \
# --store-password-in-clear-text \
# --name github \
# "https://nuget.pkg.github.com/NHSDigital/index.json"
# - run: |
# echo "ROOT .version file is: $(cat .version)"
# echo "GH variable version is: ${{ inputs.version }}"
# name: Showing the base versions
# - run: |
# VERSION=${{ inputs.version }}
# SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
# NUGET_VERSION="$(echo "$VERSION" | tr + .)"
# echo $VERSION
# echo $SHORT_VERSION
# echo $NUGET_VERSION
# SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORT_NUGET_VERSION
# SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORTER_NUGET_VERSION
# TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# echo $TEST_NUGET_VERSION
# echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
# name: Set the nuget version
# id: set-nuget-version
# - run: |
# dotnet nuget push \
# nhs.notify.suppliers.api.letter.${TEST_NUGET_VERSION}.nupkg \
# --source github \
# --api-key $GITHUB_TOKEN
# env:
# TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ### PUBLISH LIBS data NUGET
# publishlibhostnuget:
# name: "Publish libs data packages to nuget.pkg.github.com"
# runs-on: ubuntu-latest
# needs: [publish]
# permissions:
# packages: write
# contents: read
# steps:
# - name: "Get the artefacts"
# uses: actions/download-artifact@v5
# with:
# path: .
# name: libs-data-${{ inputs.version }}
# - run: |
# ls -la
# find . -name ".version"
# - run: |
# dotnet nuget add source \
# --username nhs-notify-supplier-api \
# --password ${{ secrets.GITHUB_TOKEN }} \
# --store-password-in-clear-text \
# --name github \
# "https://nuget.pkg.github.com/NHSDigital/index.json"
# - run: |
# echo "ROOT .version file is: $(cat .version)"
# echo "GH variable version is: ${{ inputs.version }}"
# name: Showing the base versions
# - run: |
# VERSION=${{ inputs.version }}
# SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
# NUGET_VERSION="$(echo "$VERSION" | tr + .)"
# echo $VERSION
# echo $SHORT_VERSION
# echo $NUGET_VERSION
# SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORT_NUGET_VERSION
# SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORTER_NUGET_VERSION
# TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# echo $TEST_NUGET_VERSION
# echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
# name: Set the nuget version
# id: set-nuget-version
# - run: |
# dotnet nuget push \
# nhs.notify.suppliers.api.data.${TEST_NUGET_VERSION}.nupkg \
# --source github \
# --api-key $GITHUB_TOKEN
# env:
# TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ### PUBLISH LIBS host NUGET
# publishlibdatanuget:
# name: "Publish libs host packages to nuget.pkg.github.com"
# runs-on: ubuntu-latest
# needs: [publish]
# permissions:
# packages: write
# contents: read
# steps:
# - name: "Get the artefacts"
# uses: actions/download-artifact@v5
# with:
# path: .
# name: libs-host-${{ inputs.version }}
# - run: |
# ls -la
# find . -name ".version"
# - run: |
# dotnet nuget add source \
# --username nhs-notify-supplier-api \
# --password ${{ secrets.GITHUB_TOKEN }} \
# --store-password-in-clear-text \
# --name github \
# "https://nuget.pkg.github.com/NHSDigital/index.json"
# - run: |
# echo "ROOT .version file is: $(cat .version)"
# echo "GH variable version is: ${{ inputs.version }}"
# name: Showing the base versions
# - run: |
# VERSION=${{ inputs.version }}
# SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
# NUGET_VERSION="$(echo "$VERSION" | tr + .)"
# echo $VERSION
# echo $SHORT_VERSION
# echo $NUGET_VERSION
# SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORT_NUGET_VERSION
# SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
# echo $SHORTER_NUGET_VERSION
# TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
# echo $TEST_NUGET_VERSION
# echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
# name: Set the nuget version
# id: set-nuget-version
# - run: |
# dotnet nuget push \
# nhs.notify.suppliers.api.host.${TEST_NUGET_VERSION}.nupkg \
# --source github \
# --api-key $GITHUB_TOKEN
# env:
# TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ### PUBLISH LIBS host docker
# publishlibhostdocker:
# name: "Publish libs host docker"
# runs-on: ubuntu-latest
# needs: [publish]
# permissions:
# packages: write
# contents: read
# steps:
# - name: "Get the artefacts"
# uses: actions/download-artifact@v5
# with:
# path: .
# name: libs-host-docker-${{ inputs.version }}
# - run: |
# ls -Rla
# docker load --input myimage.tar
# docker image ls -a
# echo $CR_PAT | docker login ghcr.io -u nhs-notify-supplier-api --password-stdin
# docker push ghcr.io/nhsdigital/libshostdocker:latest
# env:
# CR_PAT: ${{ secrets.GITHUB_TOKEN }}