chore: update publish workflow to fix issues with versioning [skip ci]

This commit is contained in:
Stevan Freeborn
2026-07-15 13:35:22 -05:00
parent d082fc0eab
commit 6af944ba3f
+14 -8
View File
@@ -32,8 +32,18 @@ jobs:
git config --local user.name "Stevan Freeborn" git config --local user.name "Stevan Freeborn"
- name: Run versionize - name: Run versionize
id: versionize id: versionize
run: versionize -i --exit-insignificant-commits --workingDir ./src/BGR.Console --commit-suffix "[skip ci]" run: |
VERSION=$(versionize -i --exit-insignificant-commits --workingDir ./src/BGR.Console --commit-suffix "[skip ci]")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
continue-on-error: true continue-on-error: true
- name: Ensure csproj version is updated
if: steps.versionize.outcome == 'success'
run: |
VERSION="${{ steps.versionize.outputs.version }}"
NUMERIC="${VERSION#v}"
sed -i "s|<Version>.*</Version>|<Version>${NUMERIC}</Version>|" src/BGR.Console/BGR.Console.csproj
git add src/BGR.Console/BGR.Console.csproj
git diff --cached --quiet || git commit --amend --no-edit
- name: Upload changelog - name: Upload changelog
if: steps.versionize.outcome == 'success' if: steps.versionize.outcome == 'success'
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
@@ -49,6 +59,7 @@ jobs:
tags: true tags: true
outputs: outputs:
is_new_version: ${{ steps.versionize.outcome == 'success' }} is_new_version: ${{ steps.versionize.outcome == 'success' }}
version: ${{ steps.versionize.outputs.version }}
publish: publish:
needs: [version] needs: [version]
if: needs.version.outputs.is_new_version == 'true' if: needs.version.outputs.is_new_version == 'true'
@@ -78,11 +89,6 @@ jobs:
run: dotnet publish src/BGR.Console/BGR.Console.csproj -c Release -r win-x64 --self-contained -o dist/windows-os run: dotnet publish src/BGR.Console/BGR.Console.csproj -c Release -r win-x64 --self-contained -o dist/windows-os
- name: Create zip for windows-os - name: Create zip for windows-os
run: zip -j dist/bgr_windows_x64.zip dist/windows-os/* run: zip -j dist/bgr_windows_x64.zip dist/windows-os/*
- name: Get project version
uses: kzrnm/get-net-sdk-project-versions-action@v1
id: get-version
with:
proj-path: src/BGR.Console/BGR.Console.csproj
- name: Download changlog - name: Download changlog
uses: actions/download-artifact@v8 uses: actions/download-artifact@v8
with: with:
@@ -92,8 +98,8 @@ jobs:
uses: softprops/action-gh-release@v3 uses: softprops/action-gh-release@v3
with: with:
token: ${{ secrets.ACTIONS_PAT }} token: ${{ secrets.ACTIONS_PAT }}
name: bgr v${{ steps.get-version.outputs.version }} name: bgr ${{ needs.version.outputs.version }}
tag_name: v${{ steps.get-version.outputs.version }} tag_name: ${{ needs.version.outputs.version }}
draft: false draft: false
body_path: src/BGR.Console/CHANGELOG.md body_path: src/BGR.Console/CHANGELOG.md
files: | files: |