diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 9214e4c5241..3e5f74e47a7 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -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}} diff --git a/.github/workflows/close-milestone.yml b/.github/workflows/close-milestone.yml index 98ce372db3d..b8fadcb4555 100644 --- a/.github/workflows/close-milestone.yml +++ b/.github/workflows/close-milestone.yml @@ -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}} diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 00000000000..b53d58ee518 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -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 diff --git a/.github/workflows/remove-milestone.yml b/.github/workflows/remove-milestone.yml index dfede7708d7..88078f581e8 100644 --- a/.github/workflows/remove-milestone.yml +++ b/.github/workflows/remove-milestone.yml @@ -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}} diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index ecc7ff92015..53182429583 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -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}}