-
-
Notifications
You must be signed in to change notification settings - Fork 25
47 lines (42 loc) · 1.64 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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