Skip to content

Commit 09dfaf4

Browse files
committed
- fix github action Release-CI.yml
1 parent 1c6e203 commit 09dfaf4

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

.github/workflows/Release-CI.yml

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ on:
77
paths-ignore:
88
- "**/*.md"
99
- "**/*.gitignore"
10-
- "**/*.gitattributes"
10+
- "**/*.gitattributes"
1111
tags:
1212
- release-packages
1313

1414
permissions:
1515
contents: read
16+
packages: write
1617
jobs:
1718
Build-Test-Publish:
1819
runs-on: ubuntu-latest
19-
20+
2021
services:
2122
localstack:
2223
image: localstack/localstack:latest
@@ -40,7 +41,7 @@ jobs:
4041
--health-timeout 5s
4142
--health-retries 30
4243
--health-start-period 30s
43-
44+
4445
env:
4546
working-directory: ${{ github.workspace }}
4647
github-token: '${{ secrets.GH_Packages }}'
@@ -69,14 +70,23 @@ jobs:
6970
with:
7071
useConfigFile: true
7172

72-
- name: Step-04 Display Version Info
73+
- name: Step-04 Evaluate Version
74+
id: version
7375
run: |
7476
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
7577
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
7678
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
7779
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
7880
echo "Is Release: ${{ env.is-release }}"
7981
82+
if [ "${{ env.is-release }}" == "true" ]; then
83+
echo "package-version=${{ steps.gitversion.outputs.MajorMinorPatch }}" >> $GITHUB_OUTPUT
84+
echo "Using RELEASE version: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
85+
else
86+
echo "package-version=${{ steps.gitversion.outputs.NuGetVersion }}" >> $GITHUB_OUTPUT
87+
echo "Using PRE-RELEASE version: ${{ steps.gitversion.outputs.NuGetVersion }}"
88+
fi
89+
8090
- name: Step-05 Install .NET
8191
uses: actions/setup-dotnet@v3
8292
with:
@@ -86,15 +96,15 @@ jobs:
8696
run: |
8797
echo "Waiting for LocalStack to be fully ready..."
8898
echo "Testing connection to localhost:4566..."
89-
99+
90100
# Test basic connectivity first
91101
if ! nc -zv localhost 4566 2>&1; then
92102
echo "ERROR: Cannot connect to localhost:4566"
93103
echo "Checking if LocalStack container is running..."
94104
docker ps -a
95105
exit 1
96106
fi
97-
107+
98108
echo "Port 4566 is accessible, checking health endpoint..."
99109
max_attempts=30
100110
attempt=0
@@ -103,12 +113,12 @@ jobs:
103113
echo "LocalStack is ready!"
104114
echo "Health endpoint response:"
105115
curl -s http://localhost:4566/_localstack/health | jq '.'
106-
116+
107117
echo ""
108118
echo "Testing if services are available..."
109119
health_response=$(curl -s http://localhost:4566/_localstack/health)
110120
echo "Full health response: $health_response"
111-
121+
112122
break
113123
fi
114124
attempt=$((attempt + 1))
@@ -121,7 +131,7 @@ jobs:
121131
docker logs $(docker ps -q --filter ancestor=localstack/localstack:latest) || echo "Could not get container logs"
122132
exit 1
123133
fi
124-
134+
125135
echo ""
126136
echo "LocalStack is ready for tests!"
127137
@@ -133,14 +143,8 @@ jobs:
133143
run: dotnet restore --no-cache --force
134144
working-directory: '${{ env.working-directory }}'
135145

136-
- name: Step-08 Build Version (Pre-release)
137-
if: ${{ env.is-release != 'true' }}
138-
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
139-
working-directory: '${{ env.working-directory }}'
140-
141-
- name: Step-08 Build Version (Release)
142-
if: ${{ env.is-release == 'true' }}
143-
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
146+
- name: Step-08 Build Version ${{ steps.version.outputs.package-version }}
147+
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.version.outputs.package-version }}
144148
working-directory: '${{ env.working-directory }}'
145149

146150
- name: Step-09 Run Unit Tests
@@ -162,25 +166,22 @@ jobs:
162166
AWS_ENDPOINT_URL: http://localhost:4566
163167
GITHUB_ACTIONS: true
164168

165-
- name: Step-10 Create NuGet Package (Pre-release)
166-
if: ${{ env.is-release != 'true' }}
167-
run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersion }}
168-
working-directory: '${{ env.working-directory }}'
169-
170-
- name: Step-10 Create NuGet Package (Release)
171-
if: ${{ env.is-release == 'true' }}
172-
run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
169+
- name: Step-10 Create NuGet Package ${{ steps.version.outputs.package-version }}
170+
run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.version.outputs.package-version }}
173171
working-directory: '${{ env.working-directory }}'
174172

175173
- name: Step-11 Publish to Github Packages
176-
if: ${{ env.is-release == 'true' }}
177174
run: |
178-
dotnet tool install gpr --global
179-
find ./packages -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
175+
dotnet nuget add source --username CodeShayk --password ${{ secrets.GITHUB_TOKEN }} \
176+
--store-password-in-clear-text --name github \
177+
"https://nuget.pkg.github.com/CodeShayk/index.json" || true
178+
find ./packages -name "*.nupkg" -print -exec \
179+
dotnet nuget push {} --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} \
180+
--source "https://nuget.pkg.github.com/CodeShayk/index.json" \;
180181
working-directory: '${{ env.working-directory }}'
181182

182183
- name: Step-12 Publish to NuGet.org
183-
if: ${{ 'false' && env.is-release == 'true' && env.nuget-token != '' }}
184+
if: ${{ env.is-release == 'true' && env.nuget-token != '' }}
184185
run: |
185186
find ./packages -name "*.nupkg" -print -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \;
186-
working-directory: '${{ env.working-directory }}'
187+
working-directory: '${{ env.working-directory }}'

0 commit comments

Comments
 (0)