-
Notifications
You must be signed in to change notification settings - Fork 11
67 lines (63 loc) · 2.25 KB
/
Copy pathrelease.yml
File metadata and controls
67 lines (63 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
permissions:
contents: write
actions: read
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