From 52425539e970fd589d3e724261ed9aa9374f6527 Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Tue, 26 Mar 2024 18:25:25 +0100 Subject: [PATCH 1/3] feat: automate unified release by issue creation Signed-off-by: Adrien Mannocci --- .github/ISSUE_TEMPLATE/unified-release.yml | 47 +++++++++++++ .github/workflows/run-minor-release.yml | 2 +- .github/workflows/run-patch-release.yml | 2 +- .github/workflows/unified-release.yml | 78 ++++++++++++++++++++++ 4 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/unified-release.yml create mode 100644 .github/workflows/unified-release.yml diff --git a/.github/ISSUE_TEMPLATE/unified-release.yml b/.github/ISSUE_TEMPLATE/unified-release.yml new file mode 100644 index 00000000000..7c2a1c6ee3d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/unified-release.yml @@ -0,0 +1,47 @@ +--- + +name: Unified Release Manager +description: Test +labels: + - unified-release + +title: Unified Release + +body: +- type: markdown + attributes: + value: | + ## Unified Release Day + + We are releasing a new version today. + 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..88bc2f0d855 --- /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@v3 + 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 }}))' + }) From effbff6497cdd95dbff167f4c8db96357d265cbb Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Wed, 27 Mar 2024 14:08:41 +0100 Subject: [PATCH 2/3] ci: use commit sha instead of tag Signed-off-by: Adrien Mannocci --- .github/workflows/unified-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml index 88bc2f0d855..975fef379f5 100644 --- a/.github/workflows/unified-release.yml +++ b/.github/workflows/unified-release.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: stefanbuck/github-issue-parser@v3 + - uses: stefanbuck/github-issue-parser@1e5bdee70d4b3e066a33aa0669ab782943825f94 id: issue-parser with: template-path: .github/ISSUE_TEMPLATE/unified-release.yml From 5bdf56da8b73728c91b35babd086d20d65704750 Mon Sep 17 00:00:00 2001 From: Adrien Mannocci Date: Wed, 27 Mar 2024 14:21:24 +0100 Subject: [PATCH 3/3] ci: update issue template Signed-off-by: Adrien Mannocci --- .github/ISSUE_TEMPLATE/unified-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/unified-release.yml b/.github/ISSUE_TEMPLATE/unified-release.yml index 7c2a1c6ee3d..12479ec0282 100644 --- a/.github/ISSUE_TEMPLATE/unified-release.yml +++ b/.github/ISSUE_TEMPLATE/unified-release.yml @@ -1,7 +1,7 @@ --- name: Unified Release Manager -description: Test +description: Automate the minor and patch releases for the Unified Release labels: - unified-release @@ -11,9 +11,9 @@ body: - type: markdown attributes: value: | - ## Unified Release Day + ## Unified Release - We are releasing a new version today. + We are releasing a new version. Please make sure that the automation complete. - type: input