Skip to content

Increment version to 2.17.1-SNAPSHOT (#409) #7

Increment version to 2.17.1-SNAPSHOT (#409)

Increment version to 2.17.1-SNAPSHOT (#409) #7

Workflow file for this run

name: Increment Version
on:
push:
tags:
- '*.*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: GitHub App token
id: github_app_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780
- uses: actions/checkout@v2
- name: Fetch Tag and Version Information
run: |
TAG=$(echo "${GITHUB_REF#refs/*/}")
CURRENT_VERSION_ARRAY=($(echo "$TAG" | tr . '\n'))
BASE=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:2}")
CURRENT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
CURRENT_VERSION_ARRAY[2]=$((CURRENT_VERSION_ARRAY[2]+1))
NEXT_VERSION=$(IFS=. ; echo "${CURRENT_VERSION_ARRAY[*]:0:3}")
echo "TAG=$TAG" >> $GITHUB_ENV
echo "BASE=$BASE" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
ref: ${{ env.BASE }}
token: ${{ steps.github_app_token.outputs.token }}
- name: Increment Version
run: |
echo Incrementing $CURRENT_VERSION to $NEXT_VERSION
sed -i "s/$CURRENT_VERSION-SNAPSHOT/$NEXT_VERSION-SNAPSHOT/g" build.gradle
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ steps.github_app_token.outputs.token }}
base: ${{ env.BASE }}
commit-message: Incremented version to ${{ env.NEXT_VERSION }}
signoff: true
delete-branch: true
title: '[AUTO] Incremented version to ${{ env.NEXT_VERSION }}.'
body: |
I've noticed that a new tag ${{ env.TAG }} was pushed, and incremented the version from ${{ env.CURRENT_VERSION }} to ${{ env.NEXT_VERSION }}.