Skip to content

Feature/spec update fix #111

Feature/spec update fix

Feature/spec update fix #111

# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle
name: Autoincrement project version
on:
pull_request:
types: [opened,labeled,unlabeled]
branches:
- master
jobs:
increment_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: ${{ github.head_ref }}
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Set Project Version
env:
event: ${{ github.event.action }}
event_label_name: ${{ github.event.label.name }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
if [ "$event" == "opened" ] || ([ "$event" == "unlabeled" ] && [ "$event_label_name" == "do_not_increment_version" ])
then
./gradlew incrementProjectVersion --no-daemon
git commit -m "autoincrement project version" -a || echo "no changes"
elif [ "$event" == "labeled" ] && [ "$event_label_name" == "do_not_increment_version" ]
then
./gradlew decrementProjectVersion --no-daemon
git commit -m "autodecrement project version" -a || echo "no changes"
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}