Skip to content

Commit f53c115

Browse files
committed
Run tests on pull request
1 parent c048425 commit f53c115

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/ci-cd.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
tags:
66
- '*'
7+
pull_request:
8+
branches:
9+
- '**'
710

811
jobs:
912
build-and-test:
@@ -16,10 +19,18 @@ jobs:
1619
java-version: '25'
1720
distribution: 'temurin'
1821
cache: maven
22+
- name: Set version
23+
run: |
24+
if [[ $GITHUB_REF == refs/tags/* ]]; then
25+
echo "REVISION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
26+
else
27+
echo "REVISION=0.0.0-SNAPSHOT" >> $GITHUB_ENV
28+
fi
1929
- name: Build with Maven
20-
run: mvn -B package -Drevision=${{ github.ref_name }} --file pom.xml
30+
run: mvn -B package -Drevision=${{ env.REVISION }} --file pom.xml
2131

2232
publish:
33+
if: startsWith(github.ref, 'refs/tags/')
2334
needs: build-and-test
2435
runs-on: ubuntu-latest
2536
permissions:

0 commit comments

Comments
 (0)