Skip to content

Commit 2d08b91

Browse files
Robu6/libs nuget example (#61)
* Adding libs examples. * Add libs action to build stage. * correct typo * run.sh assembly names. * secrets. * CCM-11007: Fixing log destination for Splunk forwarding (#58) * Robu6/libs nuget example (#57) * Adding libs examples. * Add libs action to build stage. * correct typo * run.sh assembly names. * rebased to main. * .... * <<< left in * Adding other example poc libs. * timeouts of actions increased to 10m from 3m. * version copy to abstract folder. * version file not in libs on github. * find .version and print on pub. * debugging in build. * include .version in libs - artifact hidden files. --------- Co-authored-by: sidnhs <[email protected]>
1 parent bced6a6 commit 2d08b91

File tree

13 files changed

+275
-34
lines changed

13 files changed

+275
-34
lines changed

.github/actions/build-libraries/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,25 @@ runs:
2929
with:
3030
path: "src/server/abstractions/bin/Release"
3131
name: libs-abstractions-${{ inputs.version }}
32+
include-hidden-files: true
3233

3334
- name: Upload data artifact
3435
uses: actions/upload-artifact@v4
3536
with:
3637
path: "src/server/data/bin/Release"
3738
name: libs-data-${{ inputs.version }}
39+
include-hidden-files: true
3840

3941
- name: Upload letter artifact
4042
uses: actions/upload-artifact@v4
4143
with:
4244
path: "src/server/letter/bin/Release"
4345
name: libs-letter-${{ inputs.version }}
46+
include-hidden-files: true
4447

4548
- name: Upload host artifact
4649
uses: actions/upload-artifact@v4
4750
with:
4851
path: "src/server/host/bin/Release"
4952
name: libs-host-${{ inputs.version }}
53+
include-hidden-files: true

.github/workflows/stage-3-build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
artefact-jekyll-docs:
3737
name: "Build Docs"
3838
runs-on: ubuntu-latest
39-
timeout-minutes: 3
39+
timeout-minutes: 10
4040
steps:
4141
- name: "Checkout code"
4242
uses: actions/checkout@v4
@@ -48,7 +48,7 @@ jobs:
4848
artefact-sdks:
4949
name: "Build SDKs"
5050
runs-on: ubuntu-latest
51-
timeout-minutes: 3
51+
timeout-minutes: 10
5252
steps:
5353
- name: "Checkout code"
5454
uses: actions/checkout@v4
@@ -60,7 +60,7 @@ jobs:
6060
artefact-servers:
6161
name: "Build servers"
6262
runs-on: ubuntu-latest
63-
timeout-minutes: 3
63+
timeout-minutes: 10
6464
steps:
6565
- name: "Checkout code"
6666
uses: actions/checkout@v4
@@ -72,7 +72,7 @@ jobs:
7272
artefact-libs:
7373
name: "Build libs"
7474
runs-on: ubuntu-latest
75-
timeout-minutes: 3
75+
timeout-minutes: 10
7676
steps:
7777
- name: "Checkout code"
7878
uses: actions/checkout@v4

.github/workflows/stage-5-publish.yaml

Lines changed: 179 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
publish:
4040
name: "Publish packages"
4141
runs-on: ubuntu-latest
42-
timeout-minutes: 3
42+
timeout-minutes: 10
4343

4444
steps:
4545
- name: "Checkout code"
@@ -243,7 +243,8 @@ jobs:
243243
with:
244244
path: .
245245
name: sdk-csharp-${{ inputs.version }}
246-
- run: ls -la
246+
- run: |
247+
ls -la
247248
- run: |
248249
dotnet nuget add source \
249250
--username nhs-notify-supplier-api \
@@ -367,7 +368,9 @@ jobs:
367368
with:
368369
path: .
369370
name: libs-abstractions-${{ inputs.version }}
370-
- run: ls -la
371+
- run: |
372+
ls -la
373+
find . -name ".version"
371374
- run: |
372375
dotnet nuget add source \
373376
--username nhs-notify-supplier-api \
@@ -406,3 +409,176 @@ jobs:
406409
env:
407410
TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
408411
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
412+
413+
414+
415+
### PUBLISH LIBS LETTERS NUGET
416+
publishliblettersnuget:
417+
name: "Publish libs letter packages to nuget.pkg.github.com"
418+
runs-on: ubuntu-latest
419+
needs: [publish]
420+
permissions:
421+
packages: write
422+
contents: read
423+
steps:
424+
- name: "Get the artefacts"
425+
uses: actions/download-artifact@v4
426+
with:
427+
path: .
428+
name: libs-letter-${{ inputs.version }}
429+
- run: |
430+
ls -la
431+
find . -name ".version"
432+
- run: |
433+
dotnet nuget add source \
434+
--username nhs-notify-supplier-api \
435+
--password ${{ secrets.GITHUB_TOKEN }} \
436+
--store-password-in-clear-text \
437+
--name github \
438+
"https://nuget.pkg.github.com/NHSDigital/index.json"
439+
- run: |
440+
echo "ROOT .version file is: $(cat .version)"
441+
echo "GH variable version is: ${{ inputs.version }}"
442+
name: Showing the base versions
443+
444+
- run: |
445+
VERSION=${{ inputs.version }}
446+
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
447+
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
448+
echo $VERSION
449+
echo $SHORT_VERSION
450+
echo $NUGET_VERSION
451+
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
452+
echo $SHORT_NUGET_VERSION
453+
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
454+
echo $SHORTER_NUGET_VERSION
455+
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
456+
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
457+
echo $TEST_NUGET_VERSION
458+
echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
459+
name: Set the nuget version
460+
id: set-nuget-version
461+
462+
- run: |
463+
dotnet nuget push \
464+
nhs.notify.suppliers.api.letter.${TEST_NUGET_VERSION}.nupkg \
465+
--source github \
466+
--api-key $GITHUB_TOKEN
467+
env:
468+
TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
469+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
470+
471+
472+
### PUBLISH LIBS data NUGET
473+
publishlibhostnuget:
474+
name: "Publish libs host packages to nuget.pkg.github.com"
475+
runs-on: ubuntu-latest
476+
needs: [publish]
477+
permissions:
478+
packages: write
479+
contents: read
480+
steps:
481+
- name: "Get the artefacts"
482+
uses: actions/download-artifact@v4
483+
with:
484+
path: .
485+
name: libs-host-${{ inputs.version }}
486+
- run: |
487+
ls -la
488+
find . -name ".version"
489+
- run: |
490+
dotnet nuget add source \
491+
--username nhs-notify-supplier-api \
492+
--password ${{ secrets.GITHUB_TOKEN }} \
493+
--store-password-in-clear-text \
494+
--name github \
495+
"https://nuget.pkg.github.com/NHSDigital/index.json"
496+
- run: |
497+
echo "ROOT .version file is: $(cat .version)"
498+
echo "GH variable version is: ${{ inputs.version }}"
499+
name: Showing the base versions
500+
501+
- run: |
502+
VERSION=${{ inputs.version }}
503+
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
504+
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
505+
echo $VERSION
506+
echo $SHORT_VERSION
507+
echo $NUGET_VERSION
508+
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
509+
echo $SHORT_NUGET_VERSION
510+
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
511+
echo $SHORTER_NUGET_VERSION
512+
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
513+
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
514+
echo $TEST_NUGET_VERSION
515+
echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
516+
name: Set the nuget version
517+
id: set-nuget-version
518+
519+
- run: |
520+
dotnet nuget push \
521+
nhs.notify.suppliers.api.host.${TEST_NUGET_VERSION}.nupkg \
522+
--source github \
523+
--api-key $GITHUB_TOKEN
524+
env:
525+
TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
526+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
527+
528+
529+
530+
### PUBLISH LIBS host NUGET
531+
publishlibdatanuget:
532+
name: "Publish libs host packages to nuget.pkg.github.com"
533+
runs-on: ubuntu-latest
534+
needs: [publish]
535+
permissions:
536+
packages: write
537+
contents: read
538+
steps:
539+
- name: "Get the artefacts"
540+
uses: actions/download-artifact@v4
541+
with:
542+
path: .
543+
name: libs-host-${{ inputs.version }}
544+
- run: |
545+
ls -la
546+
find . -name ".version"
547+
- run: |
548+
dotnet nuget add source \
549+
--username nhs-notify-supplier-api \
550+
--password ${{ secrets.GITHUB_TOKEN }} \
551+
--store-password-in-clear-text \
552+
--name github \
553+
"https://nuget.pkg.github.com/NHSDigital/index.json"
554+
- run: |
555+
echo "ROOT .version file is: $(cat .version)"
556+
echo "GH variable version is: ${{ inputs.version }}"
557+
name: Showing the base versions
558+
559+
- run: |
560+
VERSION=${{ inputs.version }}
561+
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
562+
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
563+
echo $VERSION
564+
echo $SHORT_VERSION
565+
echo $NUGET_VERSION
566+
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
567+
echo $SHORT_NUGET_VERSION
568+
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
569+
echo $SHORTER_NUGET_VERSION
570+
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
571+
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
572+
echo $TEST_NUGET_VERSION
573+
echo "TEST_NUGET_VERSION=$TEST_NUGET_VERSION" >> "$GITHUB_OUTPUT"
574+
name: Set the nuget version
575+
id: set-nuget-version
576+
577+
- run: |
578+
dotnet nuget push \
579+
nhs.notify.suppliers.api.host.${TEST_NUGET_VERSION}.nupkg \
580+
--source github \
581+
--api-key $GITHUB_TOKEN
582+
env:
583+
TEST_NUGET_VERSION: ${{ steps.set-nuget-version.outputs.TEST_NUGET_VERSION }}
584+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build: # Build the project artefact @Pipeline
1414
(cd server && make build)
1515
(cd sdk && make build)
1616
(cd docs && make build)
17-
17+
(cd libs && make build)
1818
publish: # Publish the project artefact @Pipeline
1919
# TODO: Implement the artefact publishing step
2020

sdk/_config.version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 0.2.0-20250704.123845+a16df0f
1+
version: 0.2.0-20250708.142731+ca74a4e

server/_config.version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 0.2.0-20250704.123842+a16df0f
1+
version: 0.2.0-20250708.142722+ca74a4e

src/server/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SHELL = /bin/bash
55

66
build: version #VER=$$(cat .version) # Build the project artefact @Pipeline
77
VER=$$(cat .version) && \
8-
echo $$VER
8+
echo $$VER && \
99
./build.sh $$VER
1010

1111
version:

src/server/_config.version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 0.2.0-20250708.102840+fb71052
1+
version: 0.2.0-20250708.200258+fdc7cef

src/server/abstractions/abstractions.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<Nullable>enable</Nullable>
77
<PublishTrimmed>false</PublishTrimmed>
88
<AssemblyName>nhs.notify.suppliers.api.abstractions</AssemblyName>
9+
<NoDefaultExcludes>true</NoDefaultExcludes>
910
</PropertyGroup>
1011

1112
<ItemGroup>
@@ -16,5 +17,9 @@
1617
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.6" />
1718
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.6" />
1819
</ItemGroup>
19-
20+
<ItemGroup>
21+
<Content Include=".version">
22+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
23+
</Content>
24+
</ItemGroup>
2025
</Project>

0 commit comments

Comments
 (0)