2020-11-15 04:50:43 -06:00
name : Bump version
on :
workflow_dispatch :
inputs :
version :
2022-09-28 03:52:42 -05:00
description: 'Needs to match, exactly, the name of a milestone. The version to be released please respect: major.minor.patch or major.minor.patch-beta<number> format. example : 7.4 .3 or 7.4.3-beta1'
2020-11-15 04:50:43 -06:00
required : true
2022-03-01 04:16:18 -06:00
env :
YARN_ENABLE_IMMUTABLE_INSTALLS : false
2020-11-15 04:50:43 -06:00
jobs :
main :
runs-on : ubuntu-latest
steps :
2021-03-11 08:38:58 -06:00
# This is a basic workflow to help you get started with Actions
2021-09-28 06:16:02 -05:00
- uses : actions-ecosystem/action-regex-match@v2.0.2
2021-12-21 07:34:05 -06:00
if : ${{ github.event.inputs.version != '' }}
2021-03-11 08:38:58 -06:00
id : regex-match
with :
text : ${{ github.event.inputs.version }}
regex : '^(\d+.\d+).\d+(?:-beta.\d+)?$'
2021-12-21 07:34:05 -06:00
- uses : actions-ecosystem/action-regex-match@v2.0.2
if : ${{ inputs.version_call != '' }}
id : regex-match-version-call
with :
text : ${{ inputs.version_call }}
regex : '^(\d+.\d+).\d+(?:-beta\d+)?$'
2021-03-11 08:38:58 -06:00
- name : Validate input version
2021-12-21 07:34:05 -06:00
if : ${{ steps.regex-match.outputs.match == '' && github.event.inputs.version != '' }}
2021-03-11 08:38:58 -06:00
run : |
echo "The input version format is not correct, please respect:\
major.minor.patch or major.minor.patch-beta.number format. \
example : 7.4 .3 or 7.4.3-beta.1"
exit 1
2021-12-21 07:34:05 -06:00
- name : Validate input version call
if : ${{ inputs.version_call != '' && steps.regex-match-version-call.outputs.match == '' }}
run : |
echo "The input version format is not correct, please respect:\
major.minor.patch or major.minor.patch-beta<number> format. \
example : 7.4 .3 or 7.4.3-beta1"
exit 1
2022-04-08 03:26:30 -05:00
- uses : actions/checkout@v3
2021-05-06 09:29:29 -05:00
2021-03-11 08:38:58 -06:00
- name : Set intermedia variables
id : intermedia
run : |
2022-11-10 03:24:19 -06:00
echo "short_ref=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
echo "check_passed=false" >> $GITHUB_OUTPUT
echo "branch_name=v${{steps.regex-match.outputs.group1}}" >> $GITHUB_OUTPUT
echo "branch_exist=$(git ls-remote --heads https://github.com/grafana/grafana.git v${{ steps.regex-match.outputs.group1 }}.x | wc -l)" >> $GITHUB_OUTPUT
2021-05-06 09:29:29 -05:00
- name : Check input version is aligned with branch(main)
2021-12-21 07:34:05 -06:00
if : ${{ github.event.inputs.version != '' && steps.intermedia.outputs.branch_exist == '0' && !contains(steps.intermedia.outputs.short_ref, 'main') }}
2021-03-11 08:38:58 -06:00
run : |
echo "When you want to deliver a new new minor version, you might want to create a new branch first \
with naming convention v[major].[minor].x, and just run the workflow on that branch. \
2021-05-06 09:29:29 -05:00
Run the workflow on main only when needed"
2021-03-11 08:38:58 -06:00
exit 1
2021-05-06 09:29:29 -05:00
2020-11-15 04:50:43 -06:00
- name : Checkout Actions
2022-04-08 03:26:30 -05:00
uses : actions/checkout@v3
2020-11-15 04:50:43 -06:00
with :
repository : "grafana/grafana-github-actions"
path : ./actions
ref : main
2022-11-01 09:44:37 -05:00
- uses : actions/setup-node@v3.5.1
2020-11-16 14:34:19 -06:00
with :
2022-02-25 04:22:42 -06:00
node-version : '16'
2020-11-15 04:50:43 -06:00
- name : Install Actions
run : npm install --production --prefix ./actions
2022-11-03 12:47:04 -05:00
- name : Run bump version (manually invoked)
2021-12-20 07:16:22 -06:00
uses : ./actions/bump-version
with :
2021-12-21 07:34:05 -06:00
token : ${{ secrets.GH_BOT_ACCESS_TOKEN }}
metricsWriteAPIKey : ${{ secrets.GRAFANA_MISC_STATS_API_KEY }}