Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: automate unified release by issue creation #12872

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/unified-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---

name: Unified Release Manager
description: Test
amannocci marked this conversation as resolved.
Show resolved Hide resolved
labels:
- unified-release

title: Unified Release

body:
- type: markdown
attributes:
value: |
## Unified Release Day

We are releasing a new version today.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the right sentence since it's not about a release today, but it could be a Feature Freeze

Please make sure that the automation complete.

- type: input
id: upstream
attributes:
label: Parent issue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parent issue is passed, do you think the GH PR that was created could also contain a reference to it and also a reference to the GitHub issue in this project that was created?

### Issues

Part of https://github.com/elastic/dev/issues/xxx

Closes https://github.com/elastic/apm-server/issues/xxx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are pros/cons in both cases.
In my opinion, we could keep the parent relationship between those issues and let the PR reference the project issue to avoid confusion in the upstream 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
2 changes: 1 addition & 1 deletion .github/workflows/run-minor-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: run-minor-release

on:
workflow_dispatch:
workflow_call:
inputs:
version:
description: 'The version (semver format: major.minor.0)'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: run-patch-release

on:
workflow_dispatch:
workflow_call:
inputs:
version:
description: 'The version (semver format: major.minor.patch)'
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/unified-release.yml
Original file line number Diff line number Diff line change
@@ -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
amannocci marked this conversation as resolved.
Show resolved Hide resolved
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 }}))'
})