Test Increment Semantic Version #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Increment Semantic Version | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test-action: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Define the release types and their expected versions | |
release-type: | |
- { version-fragment: "major", expected-version: "2.0.0" } | |
- { version-fragment: "feature", expected-version: "1.1.0" } | |
- { version-fragment: "minor", expected-version: "1.1.0" } | |
- { version-fragment: "bug", expected-version: "1.0.1" } | |
- { version-fragment: "patch", expected-version: "1.0.1" } | |
- { version-fragment: "hotfix", expected-version: "1.0.1" } | |
- { version-fragment: "alpha", expected-version: "1.0.0-alpha.0" } | |
- { version-fragment: "beta", expected-version: "1.0.0-beta.0" } | |
- { version-fragment: "rc", expected-version: "1.0.0-rc.0" } | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Test action | |
id: increment-version | |
uses: ./ | |
with: | |
current-version: 1.0.0 | |
version-fragment: ${{ matrix.release-type.version-fragment }} | |
- name: Validate next version | |
run: | | |
EXPECTED_VERSION="${{ matrix.release-type.expected-version }}" | |
if [ "${{ steps.increment-version.outputs.next-version }}" != "$EXPECTED_VERSION" ]; then | |
echo "Validation failed! Expected $EXPECTED_VERSION but got ${{ steps.increment-version.outputs.next-version }}." | |
exit 1 | |
else | |
echo "Validation passed! Next version is $EXPECTED_VERSION as expected." | |
fi |