Skip to content

Commit

Permalink
set version in pom.xml from git tag
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-kuba committed May 13, 2022
1 parent ba4a144 commit 166869b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name: "release"
on:
push:
# Sequence of patterns matched against refs/tags
# Run for tagged commits, the tag name should be X.Y.Z to be used as version in pom.xml
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- '[1-9]*'

jobs:
publish:
Expand All @@ -26,6 +26,11 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: "get version from git tag"
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: "Set version in pom.xml to ${{ steps.get_version.outputs.VERSION }}"
run: "mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }} ; mvn versions:commit"
- name: "Compile and package"
run: mvn -B -DskipTests clean install
- name: "Create Release"
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>cz.muni</groupId>
<artifactId>aphos</artifactId>
<version>1.0.1</version>
<version>1.0.0-SNAPSHOT</version>
<name>aphos</name>
<description>Amateur Photometric Survey</description>
<properties>
Expand Down

0 comments on commit 166869b

Please sign in to comment.