Skip to content

Trigger

Trigger #23

Workflow file for this run

name: Trigger
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to release from"
required: true
default: "main"
version:
description: "Release version"
required: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 8
- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
run: mvn --no-transfer-progress -B -U --file pom.xml install
tag:
name: Tag
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
# required for triggering release workflow on tagging
token: ${{ secrets.GIT_ACCESS_TOKEN }}
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 8
- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Create tag
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
BRANCH=${{ github.event.inputs.branch }}
VERSION=${{ github.event.inputs.version }}
echo "Releasing $VERSION from $BRANCH branch"
git checkout $BRANCH
mvn --no-transfer-progress -B versions:set versions:commit -DnewVersion=$VERSION
git config --global user.email "22281426+aoudiamoncef@users.noreply.github.com"
git config --global user.name "Automated release"
git commit -a -m "build: releasing version $VERSION"
git tag v$VERSION
git push origin $BRANCH
git push origin v$VERSION