Skip to content

Commit 1edda71

Browse files
committed
fix: Improve build workflow by refining paths to ignore and ensuring full git history for versioning
1 parent 263b9fd commit 1edda71

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ jobs:
3737
uses: fkirc/skip-duplicate-actions@v5
3838
with:
3939
# Skip if only markdown files changed
40-
paths_ignore: '["**/*.md", "doc/**", "**/README*", "**/CHANGELOG*", "**/LICENSE*"]' # Don't skip on main branch or tags
40+
paths_ignore: '["**/*.md", "doc/**", "**/README*", "**/CHANGELOG*", "**/LICENSE*"]'
41+
# Don't skip on main branch or tags
4142
skip_after_successful_duplicate: 'false'
4243

4344
# Simple job for markdown-only changes
@@ -50,6 +51,7 @@ jobs:
5051
run: |
5152
echo "✅ Only documentation files were changed - skipping build"
5253
echo "📝 Changes detected in markdown files only"
54+
5355
build:
5456
runs-on: ubuntu-latest
5557
needs: check-changes
@@ -174,6 +176,7 @@ jobs:
174176
else
175177
echo "✅ No vulnerable packages found."
176178
fi
179+
177180
package-validation:
178181
runs-on: ubuntu-latest
179182
needs: [check-changes, build]
@@ -182,6 +185,8 @@ jobs:
182185
steps:
183186
- name: Checkout code
184187
uses: actions/checkout@v4
188+
with:
189+
fetch-depth: 0 # Need full history for git describe
185190

186191
- name: Setup .NET
187192
uses: actions/setup-dotnet@v4
@@ -198,7 +203,12 @@ jobs:
198203
if [[ $GITHUB_REF == refs/tags/v* ]]; then
199204
# Extract version from tag (remove 'v' prefix)
200205
VERSION=${GITHUB_REF#refs/tags/v}
201-
echo "📦 Using tag version: ${VERSION}" else
206+
echo "📦 Using tag version: ${VERSION}"
207+
IS_RELEASE_TAG="true"
208+
else
209+
# Ensure we have tags available
210+
git fetch --tags --quiet || true
211+
202212
# Get the latest git tag or use 0.1.0 as default
203213
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0")
204214
@@ -210,9 +220,11 @@ jobs:
210220
SHORT_SHA=$(git rev-parse --short HEAD)
211221
VERSION="${VERSION}-alpha.${COMMITS_SINCE_TAG}+${SHORT_SHA}"
212222
echo "📦 Using development version: ${VERSION}"
223+
IS_RELEASE_TAG="false"
213224
fi
214-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
215-
echo "is_release_tag=$([[ $GITHUB_REF == refs/tags/v* ]] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
225+
226+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
227+
echo "is_release_tag=${IS_RELEASE_TAG}" >> $GITHUB_OUTPUT
216228
217229
- name: Build (Release) for packaging
218230
run: dotnet build src/NLWebNet --configuration Release --no-restore --verbosity minimal
@@ -252,6 +264,4 @@ jobs:
252264
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
253265
tag_name: ${{ github.ref_name }}
254266
env:
255-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
256-
257-
267+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)