Skip to content

Commit 54b79d8

Browse files
trying to nuget push.
1 parent ccd8f00 commit 54b79d8

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,47 @@ jobs:
182182
asset_name: api-oas-specification-${{ inputs.version }}.zip
183183
asset_content_type: "application/gzip"
184184

185+
### PUBLISH NUGET
186+
publishnuget:
187+
name: "Publish nuget packages to nuget.pkg.github.com"
188+
runs-on: ubuntu-latest
189+
needs: [publish]
190+
permissions:
191+
packages: write
192+
contents: read
193+
steps:
194+
- name: "Get the artefacts"
195+
uses: actions/download-artifact@v4
196+
with:
197+
path: .
198+
name: sdk-csharp-${{ inputs.version }}
199+
- run: ls -la
200+
- run: |
201+
dotnet nuget add source \
202+
--username nhs-notify-supplier-api \
203+
--password ${{ secrets.GITHUB_TOKEN }} \
204+
--store-password-in-clear-text \
205+
--name github \
206+
"https://nuget.pkg.github.com/NHSDigital/index.json"
207+
- run: |
208+
VERSION=${{ inputs.version }}
209+
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
210+
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
211+
echo $VERSION
212+
echo $SHORT_VERSION
213+
echo $NUGET_VERSION
214+
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
215+
echo $SHORT_NUGET_VERSION
216+
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
217+
echo $SHORTER_NUGET_VERSION
218+
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
219+
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
220+
echo $TEST_NUGET_VERSION
221+
- run: |
222+
dotnet nuget push \
223+
nhsnotifysupplier.${TEST_NUGET_VERSION}.nupkg \
224+
--source github \
225+
--api-key ${GITHUB_TOKEN}
185226
186227
### Publish NPM
187228

82.3 KB
Binary file not shown.

sdk/generate-cs.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ generate () {
88
--rm \
99
--user $(id -u) \
1010
-v ${PWD}:/local \
11-
-e VERSION="$VERSION" \
11+
-e VERSION="$SHORT_VERSION" \
1212
openapitools/openapi-generator-cli \
1313
generate \
1414
-i /local/specification/api/notify-supplier.yml \
@@ -20,9 +20,33 @@ generate () {
2020
}
2121

2222
build () {
23-
dotnet build sdk/csharp/src/nhsnotifysupplier
23+
dotnet build sdk/csharp/src/nhsnotifysupplier --configuration Release
2424
}
2525

26+
generate_nuget_version(){
27+
echo $VERSION
28+
echo $SHORT_VERSION
29+
echo $NUGET_VERSION
30+
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
31+
echo $SHORT_NUGET_VERSION
32+
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
33+
echo $SHORTER_NUGET_VERSION
34+
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
35+
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
36+
echo $TEST_NUGET_VERSION
37+
}
38+
39+
pack(){
40+
generate_nuget_version
41+
42+
dotnet \
43+
pack sdk/csharp/src/nhsnotifysupplier \
44+
--configuration Release \
45+
/p:Version=${TEST_NUGET_VERSION} \
46+
--no-build \
47+
--output sdk/csharp
48+
49+
}
2650
prepare(){
2751
mkdir -p sdk/csharp
2852

@@ -31,11 +55,15 @@ prepare(){
3155

3256
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
3357
echo $SHORT_VERSION
58+
59+
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
60+
echo $NUGET_VERSION
3461
}
3562

3663
prepare
3764
generate
3865
build
66+
pack
3967

4068
# sed -i -e 's|https://github.com/GIT_USER_ID/GIT_REPO_ID.git|https://github.com/NHSDigital/nhs-notify-supplier-api.git|g' ./sdk/typescript/package.json
4169

0 commit comments

Comments
 (0)