diff --git a/.github/ISSUE_TEMPLATE/unified-release.yml b/.github/ISSUE_TEMPLATE/unified-release.yml new file mode 100644 index 00000000000..12479ec0282 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/unified-release.yml @@ -0,0 +1,47 @@ +--- + +name: Unified Release Manager +description: Automate the minor and patch releases for the Unified Release +labels: + - unified-release + +title: Unified Release + +body: +- type: markdown + attributes: + value: | + ## Unified Release + + We are releasing a new version. + Please make sure that the automation complete. + +- type: input + id: upstream + attributes: + label: Parent issue + description: Link to mission control upstream issue. + placeholder: https://github.com/elastic/dev/issues/xxx + validations: + required: true + +- type: input + id: version + attributes: + label: Version + description: Version to be released + placeholder: 8.13.0 + validations: + required: true + +- type: dropdown + id: type + attributes: + label: Type + description: Choose type of release + options: + - patch + - minor + default: 0 + validations: + required: true diff --git a/.github/workflows/run-minor-release.yml b/.github/workflows/run-minor-release.yml index f5dba2bb0d6..7b0a55713f3 100644 --- a/.github/workflows/run-minor-release.yml +++ b/.github/workflows/run-minor-release.yml @@ -2,7 +2,7 @@ name: run-minor-release on: - workflow_dispatch: + workflow_call: inputs: version: description: 'The version (semver format: major.minor.0)' diff --git a/.github/workflows/run-patch-release.yml b/.github/workflows/run-patch-release.yml index 2ace35f01db..054bc61b0f8 100644 --- a/.github/workflows/run-patch-release.yml +++ b/.github/workflows/run-patch-release.yml @@ -2,7 +2,7 @@ name: run-patch-release on: - workflow_dispatch: + workflow_call: inputs: version: description: 'The version (semver format: major.minor.patch)' diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml new file mode 100644 index 00000000000..975fef379f5 --- /dev/null +++ b/.github/workflows/unified-release.yml @@ -0,0 +1,78 @@ +--- + +name: "Unified Release Manager" + +on: + issues: + types: + - opened + +permissions: + contents: read + issues: write + +# Avoid running if there is already an on-going action running for the same +# GitHub issue +concurrency: + group: "${{ github.workflow }}-${{ github.event.issue.number }}" + +env: + RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + +jobs: + parse-issue: + if: contains(github.event.issue.labels.*.name, 'unified-release') + runs-on: ubuntu-latest + outputs: + payload: ${{ steps.issue-parser.outputs.jsonString }} + steps: + - uses: actions/checkout@v4 + + - uses: stefanbuck/github-issue-parser@1e5bdee70d4b3e066a33aa0669ab782943825f94 + id: issue-parser + with: + template-path: .github/ISSUE_TEMPLATE/unified-release.yml + + run-minor-release: + needs: + - parse-issue + if: fromJson(needs.parse-issue.outputs.payload).type == 'minor' + uses: ./.github/workflows/run-minor-release.yml + with: + version: ${{ fromJson(needs.parse-issue.outputs.payload).version }} + + run-patch-release: + needs: + - parse-issue + if: fromJson(needs.parse-issue.outputs.payload).type == 'patch' + uses: ./.github/workflows/run-patch-release.yml + with: + version: ${{ fromJson(needs.parse-issue.outputs.payload).version }} + + notify: + runs-on: ubuntu-latest + if: always() + needs: + - run-minor-release + - run-patch-release + steps: + - id: check + uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current + with: + needs: ${{ toJSON(needs) }} + + - name: Notify - success + if: steps.check.outputs.status == 'success' + uses: peter-evans/close-issue@276d7966e389d888f011539a86c8920025ea0626 + + - name: Notify - failed + if: steps.check.outputs.status == 'failure' + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '💔 Something went wrong. @elastic/observablt-robots, can you please help? ([logs](${{ env.RUN_URL }}))' + })