Skip to content

Commit

Permalink
Validate versions on CI (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz authored Nov 8, 2023
1 parent b0f829e commit 56608d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ jobs:
version=$(echo "$props" | grep -oPm1 "(?<=<Version>)[^<]*")
echo "version=$version" >> $GITHUB_OUTPUT
- name: Validate new version
- name: Validate new version (format)
# Use regex to make sure the version is 1.2.3 or 1.2.3-ci-abcdef0
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z].*)?$ ]]; then
echo "Invalid version: ${{ inputs.version }}"
exit 1
fi
- name: Validate new version (increment)
run: >
npx [email protected] "${{ inputs.version }}"
--range "> ${{ steps.current-version.outputs.version }}"
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ jobs:
- name: Determine stable version
id: stable-version
if: ${{ github.event_name == 'release' }}
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
run: |
if ! [[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z].*)?$ ]]; then
echo "Invalid version: ${{ github.event.release.tag_name }}"
exit 1
fi
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
- name: Determine prerelease version
id: pre-version
Expand Down Expand Up @@ -139,7 +145,7 @@ jobs:
--configuration Release
-p:ContinuousIntegrationBuild=true
- name: Create packages
- name: Run pack
run: >
dotnet pack
-p:Version=${{ needs.version.outputs.version }}
Expand Down

0 comments on commit 56608d4

Please sign in to comment.