Skip to content

Update test.yml

Update test.yml #7

Workflow file for this run

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.1" }
- { version-fragment: "beta", expected-version: "1.0.0-beta.1" }
- { version-fragment: "rc", expected-version: "1.0.0-rc.1" }
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