Skip to content

Preform minor release of refs/heads/main branch #72

Preform minor release of refs/heads/main branch

Preform minor release of refs/heads/main branch #72

Workflow file for this run

name: Automated Release
run-name: "${{ inputs.dry_run && 'Dry-run for ' || 'Preform ' }} ${{ inputs.release_type }} release of ${{ github.ref }} branch"
on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: The release type
options:
- "major"
- "minor"
- "patch"
default: "minor"
dry_run:
description: Perform the release dry-run
required: true
type: boolean
default: true
jobs:
release-branch:
runs-on: ubuntu-latest
steps:
- name: Output Inputs
run: |
echo "${{ toJSON(github.event.inputs) }}"
echo "${{ toJSON(inputs) }}"
echo "${{ inputs.release_type }}"
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PUSH_SECRET }}
- name: Checkout ${{ env.GITHUB_REPOSITORY }}
run: git clone git@github.com:$GITHUB_REPOSITORY.git java-profiler
- name: Configure git env
run: |
git config --global user.email "java-profiler@datadoghq.com"
git config --global user.name "Datadog Java Profiler"
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ inputs.dry_run }}" != "true" ]; then
if [ "${{ inputs.release_type }}" != "patch" ]&& [[ ${GITHUB_REF_NAME} =~ release/.* ]]; then
echo "::error Only patch release can be performed from a release branch"
exit 1
fi
if [ "${{ inputs.release_type }}" == "patch" ]&& [[ ! ${GITHUB_REF_NAME} =~ release/.* ]]; then
echo "::error::A patch release can be performed only from a release branch"
exit 1
fi
if [ "${{ inputs.release_type }}" != "patch" ]&& [[ ! ${GITHUB_REF_NAME} =~ main ]]; then
echo "::error::A major or minor release can be performed only from 'main' branch"
exit 1
fi
else
DRY_RUN="--dry-run"
fi
TYPE="${{ inputs.release_type }}"
cd java-profiler
git checkout $GITHUB_REF_NAME
./.github/scripts/release.sh ${TYPE^^} $DRY_RUN