Skip to content

Commit

Permalink
Determine the version
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Jul 30, 2020
1 parent 6ac58a4 commit 6663608
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Determine the version
# Updates the build version to the tag if it's a release.
# Otherwise updates the build version to latest tag with the branch name as a suffix (i.e. 1.0.0-feature-upload).
run: |
LAST_VERSION=$(git describe --tags --always --first-parent)
VERSION_SUFFIX=$(echo ${{ github.head_ref }} | sed -e 's/^refs\///' -e 's/[^0-9a-zA-Z\-_]/-/g')
BUILD_VERSION=$([[ "${{ github.event_name }}" == "release" ]] && echo $LAST_VERSION || echo "$LAST_VERSION-$VERSION_SUFFIX")
sed -i'' -e "/^version=/s/=.*/=$BUILD_VERSION/" gradle.properties
echo $BUILD_VERSION
echo "::set-output name=BUILD_VERSION::$BUILD_VERSION"
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
Expand Down

0 comments on commit 6663608

Please sign in to comment.