Chore: Create prepare release action (#43357)

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
This commit is contained in:
Maria Alexandra 2021-12-20 14:16:22 +01:00 committed by GitHub
parent e1be23ac1e
commit 0ce7799046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 6 deletions

View File

@ -5,6 +5,12 @@ on:
version:
required: true
default: '7.x.x'
workflow_call:
inputs:
version_call:
description: Needs to match, exactly, the name of a version
required: true
type: string
jobs:
main:
runs-on: ubuntu-latest
@ -34,13 +40,13 @@ jobs:
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)
if: steps.intermedia.outputs.branch_exist != '0' && !contains(steps.intermedia.outputs.short_ref, steps.intermedia.outputs.branch_name)
if: ${{ github.event.inputs.version != '' }} && 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
- name: Check input version is aligned with branch(main)
if: steps.intermedia.outputs.branch_exist == '0' && !contains(steps.intermedia.outputs.short_ref, 'main')
if: ${{ github.event.inputs.version != '' }} && 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. \
@ -58,8 +64,17 @@ jobs:
node-version: '14'
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Run bump version
- name: Run bump version (manually invoked)
if: ${{ github.event.inputs.version != '' }}
uses: ./actions/bump-version
with:
version: ${{ github.event.inputs.version }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}
- name: Run bump version (workflow invoked)
if: ${{ inputs.version_call != '' }}
uses: ./actions/bump-version
with:
version: ${{ inputs.version_call }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}

View File

@ -5,6 +5,12 @@ on:
version:
required: true
description: Needs to match, exactly, the name of a milestone
workflow_call:
inputs:
version_call:
description: Needs to match, exactly, the name of a milestone
required: true
type: string
jobs:
main:
runs-on: ubuntu-latest
@ -17,7 +23,15 @@ jobs:
ref: main
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Close milestone
- name: Close milestone (manually invoked)
if: ${{ github.event.inputs.version != '' }}
uses: ./actions/close-milestone
with:
version: ${{ github.event.inputs.version }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
- name: Close milestone (workflow invoked)
if: ${{ inputs.version_call != '' }}
uses: ./actions/close-milestone
with:
version: ${{ inputs.version_call }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}

28
.github/workflows/prepare-release.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Prepare release
on:
workflow_dispatch:
inputs:
version_input:
description: '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-beta.1'
required: true
jobs:
call-remove-milestone:
uses: grafana/grafana/.github/workflows/remove-milestone.yml@main
with:
version_call: ${{ github.event.inputs.version_input }}
call-close-milestone:
uses: grafana/grafana/.github/workflows/close-milestone.yml@main
with:
version_call: ${{ github.event.inputs.version_input }}
needs: call-remove-milestone
call-bump-version:
uses: grafana/grafana/.github/workflows/bump-version.yml@main
with:
version_call: ${{ github.event.inputs.version_input }}
needs: call-close-milestone
call-update-changelog:
uses: grafana/grafana/.github/workflows/update-changelog.yml@main
with:
version_call: ${{ github.event.inputs.version_input }}
needs: call-bump-version

View File

@ -5,6 +5,12 @@ on:
version:
required: true
description: Needs to match, exactly, the name of a milestone
workflow_call:
inputs:
version_call:
description: Needs to match, exactly, the name of a milestone
required: true
type: string
jobs:
main:
runs-on: ubuntu-latest
@ -17,7 +23,15 @@ jobs:
ref: main
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Remove milestone from open issues
- name: Remove milestone from open issues (manually invoked)
if: ${{ github.event.inputs.version != '' }}
uses: ./actions/remove-milestone
with:
version: ${{ github.event.inputs.version }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
- name: Remove milestone from open issues (workflow invoked)
if: ${{ inputs.version_call != '' }}
uses: ./actions/remove-milestone
with:
version: ${{ inputs.version_call }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}

View File

@ -5,6 +5,12 @@ on:
version:
required: true
description: Needs to match, exactly, the name of a milestone
workflow_call:
inputs:
version_call:
description: Needs to match, exactly, the name of a milestone
required: true
type: string
jobs:
main:
runs-on: ubuntu-latest
@ -17,8 +23,17 @@ jobs:
ref: main
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Run update changelog
- name: Run update changelog (manually invoked)
if: ${{ github.event.inputs.version != '' }}
uses: ./actions/update-changelog
with:
version: ${{ github.event.inputs.version }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}
- name: Run update changelog (workflow invoked)
if: ${{ inputs.version_call != '' }}
uses: ./actions/update-changelog
with:
version: ${{ inputs.version_call }}
token: ${{secrets.GH_BOT_ACCESS_TOKEN}}
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}