diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 3e5f74e47a7..9d83e714a39 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -11,24 +11,43 @@ on: description: Needs to match, exactly, the name of a version required: true type: string + secrets: + token: + required: true + metricsWriteAPIKey: + required: true jobs: main: runs-on: ubuntu-latest steps: # This is a basic workflow to help you get started with Actions - uses: actions-ecosystem/action-regex-match@v2.0.2 + if: ${{ github.event.inputs.version != '' }} id: regex-match with: text: ${{ github.event.inputs.version }} regex: '^(\d+.\d+).\d+(?:-beta.\d+)?$' - + - 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+)?$' - name: Validate input version - if: ${{ steps.regex-match.outputs.match == '' }} + if: ${{ steps.regex-match.outputs.match == '' && github.event.inputs.version != '' }} 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 + - 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 format. \ + example: 7.4.3 or 7.4.3-beta1" + exit 1 + - uses: actions/checkout@v2 - name: Set intermedia variables @@ -40,13 +59,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: ${{ github.event.inputs.version != '' }} && 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: ${{ github.event.inputs.version != '' }} && 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. \ @@ -68,13 +87,12 @@ jobs: 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}} + 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}} + version_call: ${{ inputs.version_call }} + token: ${{ secrets.token }} + metricsWriteAPIKey: ${{ secrets.metricsWriteAPIKey }} diff --git a/.github/workflows/close-milestone.yml b/.github/workflows/close-milestone.yml index b8fadcb4555..a495eab7a8b 100644 --- a/.github/workflows/close-milestone.yml +++ b/.github/workflows/close-milestone.yml @@ -10,7 +10,10 @@ on: version_call: description: Needs to match, exactly, the name of a milestone required: true - type: string + type: string + secrets: + token: + required: true jobs: main: runs-on: ubuntu-latest @@ -27,11 +30,10 @@ jobs: if: ${{ github.event.inputs.version != '' }} uses: ./actions/close-milestone with: - version: ${{ github.event.inputs.version }} - token: ${{secrets.GH_BOT_ACCESS_TOKEN}} + 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}} + version_call: ${{ inputs.version_call }} + token: ${{ secrets.token }} diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index b53d58ee518..ed4c15a2076 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -3,26 +3,35 @@ 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' + description: 'The version to be released please respect: major.minor.patch or major.minor.patch-beta format. example: 7.4.3 or 7.4.3-beta1' required: true - jobs: call-remove-milestone: uses: grafana/grafana/.github/workflows/remove-milestone.yml@main with: version_call: ${{ github.event.inputs.version_input }} + secrets: + token: ${{ secrets.GH_BOT_ACCESS_TOKEN }} call-close-milestone: uses: grafana/grafana/.github/workflows/close-milestone.yml@main with: version_call: ${{ github.event.inputs.version_input }} + secrets: + token: ${{ secrets.GH_BOT_ACCESS_TOKEN }} needs: call-remove-milestone call-bump-version: uses: grafana/grafana/.github/workflows/bump-version.yml@main with: version_call: ${{ github.event.inputs.version_input }} + secrets: + token: ${{ secrets.GH_BOT_ACCESS_TOKEN }} + metricsWriteAPIKey: ${{ secrets.GRAFANA_MISC_STATS_API_KEY }} needs: call-close-milestone call-update-changelog: uses: grafana/grafana/.github/workflows/update-changelog.yml@main with: version_call: ${{ github.event.inputs.version_input }} + secrets: + token: ${{ secrets.GH_BOT_ACCESS_TOKEN }} + metricsWriteAPIKey: ${{ secrets.GRAFANA_MISC_STATS_API_KEY }} needs: call-bump-version diff --git a/.github/workflows/remove-milestone.yml b/.github/workflows/remove-milestone.yml index 88078f581e8..ac2504a45f8 100644 --- a/.github/workflows/remove-milestone.yml +++ b/.github/workflows/remove-milestone.yml @@ -11,6 +11,9 @@ on: description: Needs to match, exactly, the name of a milestone required: true type: string + secrets: + token: + required: true jobs: main: runs-on: ubuntu-latest @@ -27,11 +30,10 @@ jobs: if: ${{ github.event.inputs.version != '' }} uses: ./actions/remove-milestone with: - version: ${{ github.event.inputs.version }} - token: ${{secrets.GH_BOT_ACCESS_TOKEN}} + 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}} + version_call: ${{ inputs.version_call }} + token: ${{ secrets.token }} diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 53182429583..9ea0da2388e 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -3,14 +3,19 @@ on: workflow_dispatch: inputs: version: - required: true + 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 + type: string + secrets: + token: + required: true + metricsWriteAPIKey: + required: true jobs: main: runs-on: ubuntu-latest @@ -20,20 +25,19 @@ jobs: with: repository: "grafana/grafana-github-actions" path: ./actions - ref: main + ref: main - name: Install Actions run: npm install --production --prefix ./actions - 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}} + 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}} + version_call: ${{ inputs.version_call }} + token: ${{ secrets.token }} + metricsWriteAPIKey: ${{ secrets.metricsWriteAPIKey }}