Create release #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create release | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseType: | |
description: 'Release type' | |
required: true | |
type: choice | |
default: 'patch-milestone' | |
options: | |
- 'patch-milestone' | |
- 'minor-milestone' | |
- 'patch' | |
- 'minor' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
env: | |
JAVA_OPTS: "-Xmx6G" | |
SBT_OPTS: "-Dsbt.ci=true" | |
steps: | |
- name: Validate inputs | |
run: exit 1 | |
if: | | |
github.event.inputs.releaseType != 'minor' && | |
github.event.inputs.releaseType != 'patch' && | |
github.event.inputs.releaseType != 'minor-milestone' && | |
github.event.inputs.releaseType != 'patch-milestone' | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # indicates all history for all branches and tags | |
token: ${{ secrets.GATLING_CI_TOKEN }} # for tag to trigger other workflows (release) | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '8' | |
cache: 'sbt' | |
- name: Next version | |
id: tag | |
run: | | |
sbt "gatlingWriteBumpVersion ${{ github.event.inputs.releaseType }}" | |
export CURRENT_TAG="v$(cat target/gatlingNextVersion)" | |
echo "tag='$CURRENT_TAG'" | |
echo "::set-output name=tag::$CURRENT_TAG" | |
- name: Git tag | |
run: | | |
git config user.name "${{ secrets.GATLING_CI_NAME }}" | |
git config user.email "${{ secrets.GATLING_CI_EMAIL }}" | |
if [ "${{github.event.inputs.releaseType}}" = "minor-milestone" || "${{github.event.inputs.releaseType}}" = "patch-milestone" ]; then | |
git tag "${{ steps.tag.outputs.tag }}" | |
else | |
git tag "${{ steps.tag.outputs.tag }}" -m "Version ${{ steps.tag.outputs.tag }}" | |
fi | |
git push origin "${{ steps.tag.outputs.tag }}" |