Skip to content

Commit

Permalink
[GitActions][Pack] Validate against v(X.Y.Z) & set the env var VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Popescu committed Dec 18, 2023
1 parent ad1d70e commit 958cfae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ jobs:
- name: 'Validate SemVer'
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
if [[ ! "${{ github.event.inputs.version }}" =~ ^([0-9]+\.){2}[0-9]+$ ]]; then
echo "The version does not match the SemVer format (X.Y.Z). Please provide a valid version."
VERSION=${{ github.event.inputs.version }}
if [[ ! "$VERSION" =~ ^v([0-9]+\.){2}[0-9]+$ ]]; then
echo "The version does not match the SemVer format v(X.Y.Z). Please provide a valid version."
exit 1
else
echo "VERSION=$VERSION" >> $GITHUB_ENV
fi
- name: 'Print version'
Expand All @@ -52,7 +55,7 @@ jobs:
dotnet pack \
--output ./artifacts \
--configuration $BUILD_CONFIG \
--version-suffix ${{ env.VERSION }} || github.event.inputs.version
--version-suffix ${{ env.VERSION }}
- uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit 958cfae

Please sign in to comment.