2020-11-15 04:50:43 -06:00
|
|
|
name: Bump version
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
required: true
|
|
|
|
default: '7.x.x'
|
|
|
|
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
|
|
|
|
- uses: actions-ecosystem/action-regex-match@v2
|
|
|
|
id: regex-match
|
|
|
|
with:
|
|
|
|
text: ${{ github.event.inputs.version }}
|
|
|
|
regex: '^(\d+.\d+).\d+(?:-beta.\d+)?$'
|
2021-05-06 09:29:29 -05:00
|
|
|
|
2021-03-11 08:38:58 -06:00
|
|
|
- name: Validate input version
|
|
|
|
if: ${{ steps.regex-match.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-beta.1"
|
|
|
|
exit 1
|
|
|
|
- uses: actions/checkout@v2
|
2021-05-06 09:29:29 -05:00
|
|
|
|
2021-03-11 08:38:58 -06:00
|
|
|
- name: Set intermedia variables
|
|
|
|
id: intermedia
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=short_ref::${GITHUB_REF#refs/*/}"
|
|
|
|
echo "::set-output name=check_passed::false"
|
|
|
|
echo "::set-output name=branch_name::v${{steps.regex-match.outputs.group1}}"
|
2021-05-06 09:29:29 -05:00
|
|
|
echo "::set-output name=branch_exist::$(git ls-remote --heads https://github.com/grafana/grafana.git v${{ steps.regex-match.outputs.group1 }}.x | wc -l)"
|
|
|
|
|
|
|
|
- name: Check input version is aligned with branch(not main)
|
2021-03-11 08:38:58 -06:00
|
|
|
if: steps.intermedia.outputs.branch_exist != '0' && !contains(steps.intermedia.outputs.short_ref, steps.intermedia.outputs.branch_name)
|
|
|
|
run: |
|
|
|
|
echo " You need to run the workflow on branch v${{steps.regex-match.outputs.group1}}.x
|
|
|
|
exit 1
|
2021-05-06 09:29:29 -05:00
|
|
|
|
|
|
|
- name: Check input version is aligned with branch(main)
|
2021-03-11 08:38:58 -06:00
|
|
|
if: steps.intermedia.outputs.branch_exist == '0' && !contains(steps.intermedia.outputs.short_ref, 'main')
|
|
|
|
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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: "grafana/grafana-github-actions"
|
|
|
|
path: ./actions
|
|
|
|
ref: main
|
2021-03-05 00:54:23 -06:00
|
|
|
- uses: actions/setup-node@v2.1.5
|
2020-11-16 14:34:19 -06:00
|
|
|
with:
|
2020-12-08 10:09:22 -06:00
|
|
|
node-version: '14'
|
2020-11-15 04:50:43 -06:00
|
|
|
- name: Install Actions
|
|
|
|
run: npm install --production --prefix ./actions
|
|
|
|
- name: Run bump version
|
|
|
|
uses: ./actions/bump-version
|
|
|
|
with:
|
|
|
|
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
|
|
|
|
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}
|