2022-09-03 17:46:37 +02:00
|
|
|
name: Milestone's workflow
|
2022-09-02 16:22:21 +02:00
|
|
|
|
|
|
|
# /!\ No git flow are handled here
|
|
|
|
|
|
|
|
# For each Milestone created (not opened!), and if the release is NOT a patch release (only the patch changed)
|
2022-12-13 17:34:43 +01:00
|
|
|
# - the roadmap issue is created, see https://github.com/meilisearch/engine-team/blob/main/issue-templates/roadmap-issue.md
|
|
|
|
# - the changelog issue is created, see https://github.com/meilisearch/engine-team/blob/main/issue-templates/changelog-issue.md
|
2022-09-02 16:22:21 +02:00
|
|
|
|
|
|
|
# For each Milestone closed
|
|
|
|
# - the `release_version` label is created
|
|
|
|
# - this label is applied to all issues/PRs in the Milestone
|
|
|
|
|
|
|
|
on:
|
|
|
|
milestone:
|
|
|
|
types: [created, closed]
|
|
|
|
|
2022-09-02 17:07:23 +02:00
|
|
|
env:
|
|
|
|
MILESTONE_VERSION: ${{ github.event.milestone.title }}
|
|
|
|
MILESTONE_URL: ${{ github.event.milestone.html_url }}
|
|
|
|
MILESTONE_DUE_ON: ${{ github.event.milestone.due_on }}
|
|
|
|
GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }}
|
|
|
|
|
2022-09-02 16:22:21 +02:00
|
|
|
jobs:
|
|
|
|
|
|
|
|
# -----------------
|
|
|
|
# MILESTONE CREATED
|
|
|
|
# -----------------
|
|
|
|
|
|
|
|
get-release-version:
|
|
|
|
if: github.event.action == 'created'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
is-patch: ${{ steps.check-patch.outputs.is-patch }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Check if this release is a patch release only
|
|
|
|
id: check-patch
|
|
|
|
run: |
|
|
|
|
echo version: $MILESTONE_VERSION
|
|
|
|
if [[ $MILESTONE_VERSION =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
|
|
|
|
echo 'This is NOT a patch release'
|
2022-11-08 21:15:28 +01:00
|
|
|
echo "is-patch=false" >> $GITHUB_OUTPUT
|
2022-09-02 16:22:21 +02:00
|
|
|
elif [[ $MILESTONE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
echo 'This is a patch release'
|
2022-11-08 21:15:28 +01:00
|
|
|
echo "is-patch=true" >> $GITHUB_OUTPUT
|
2022-09-02 16:22:21 +02:00
|
|
|
else
|
|
|
|
echo "Not a valid format of release, check the Milestone's title."
|
|
|
|
echo 'Should be vX.Y.Z'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
create-roadmap-issue:
|
|
|
|
needs: get-release-version
|
|
|
|
# Create the roadmap issue if the release is not only a patch release
|
|
|
|
if: github.event.action == 'created' && needs.get-release-version.outputs.is-patch == 'false'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
ISSUE_TEMPLATE: issue-template.md
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Download the issue template
|
2022-12-13 17:34:43 +01:00
|
|
|
run: curl -s https://raw.githubusercontent.com/meilisearch/engine-team/main/issue-templates/roadmap-issue.md > $ISSUE_TEMPLATE
|
2022-09-20 22:39:35 +08:00
|
|
|
- name: Replace all empty occurrences in the templates
|
2022-09-02 16:22:21 +02:00
|
|
|
run: |
|
2022-09-20 22:39:35 +08:00
|
|
|
# Replace all <<version>> occurrences
|
2022-09-02 16:22:21 +02:00
|
|
|
sed -i "s/<<version>>/$MILESTONE_VERSION/g" $ISSUE_TEMPLATE
|
|
|
|
|
2022-09-20 22:39:35 +08:00
|
|
|
# Replace all <<milestone_id>> occurrences
|
2022-09-02 16:22:21 +02:00
|
|
|
milestone_id=$(echo $MILESTONE_URL | cut -d '/' -f 7)
|
|
|
|
sed -i "s/<<milestone_id>>/$milestone_id/g" $ISSUE_TEMPLATE
|
|
|
|
|
|
|
|
# Replace release date if exists
|
|
|
|
if [[ ! -z $MILESTONE_DUE_ON ]]; then
|
|
|
|
date=$(echo $MILESTONE_DUE_ON | cut -d 'T' -f 1)
|
|
|
|
sed -i "s/Release date\: 20XX-XX-XX/Release date\: $date/g" $ISSUE_TEMPLATE
|
|
|
|
fi
|
|
|
|
- name: Create the issue
|
|
|
|
run: |
|
|
|
|
gh issue create \
|
|
|
|
--title "$MILESTONE_VERSION ROADMAP" \
|
|
|
|
--label 'epic,impacts docs,impacts integrations,impacts cloud' \
|
|
|
|
--body-file $ISSUE_TEMPLATE \
|
|
|
|
--milestone $MILESTONE_VERSION
|
|
|
|
|
|
|
|
create-changelog-issue:
|
|
|
|
needs: get-release-version
|
|
|
|
# Create the changelog issue if the release is not only a patch release
|
|
|
|
if: github.event.action == 'created' && needs.get-release-version.outputs.is-patch == 'false'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
ISSUE_TEMPLATE: issue-template.md
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Download the issue template
|
2022-12-13 17:34:43 +01:00
|
|
|
run: curl -s https://raw.githubusercontent.com/meilisearch/engine-team/main/issue-templates/changelog-issue.md > $ISSUE_TEMPLATE
|
2022-09-20 22:39:35 +08:00
|
|
|
- name: Replace all empty occurrences in the templates
|
2022-09-02 16:22:21 +02:00
|
|
|
run: |
|
2022-09-20 22:39:35 +08:00
|
|
|
# Replace all <<version>> occurrences
|
2022-09-02 16:22:21 +02:00
|
|
|
sed -i "s/<<version>>/$MILESTONE_VERSION/g" $ISSUE_TEMPLATE
|
|
|
|
|
2022-09-20 22:39:35 +08:00
|
|
|
# Replace all <<milestone_id>> occurrences
|
2022-09-02 16:22:21 +02:00
|
|
|
milestone_id=$(echo $MILESTONE_URL | cut -d '/' -f 7)
|
|
|
|
sed -i "s/<<milestone_id>>/$milestone_id/g" $ISSUE_TEMPLATE
|
|
|
|
- name: Create the issue
|
|
|
|
run: |
|
|
|
|
gh issue create \
|
|
|
|
--title "Create release changelogs for $MILESTONE_VERSION" \
|
|
|
|
--label 'impacts docs,documentation' \
|
|
|
|
--body-file $ISSUE_TEMPLATE \
|
|
|
|
--milestone $MILESTONE_VERSION \
|
|
|
|
--assignee curquiza
|
|
|
|
|
2024-03-20 10:08:28 +01:00
|
|
|
create-update-version-issue:
|
|
|
|
needs: get-release-version
|
2024-03-21 15:49:25 +01:00
|
|
|
# Create the update-version issue even if the release is a patch release
|
2024-03-20 10:08:28 +01:00
|
|
|
if: github.event.action == 'created'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
ISSUE_TEMPLATE: issue-template.md
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Download the issue template
|
|
|
|
run: curl -s https://raw.githubusercontent.com/meilisearch/engine-team/main/issue-templates/update-version-issue.md > $ISSUE_TEMPLATE
|
|
|
|
- name: Create the issue
|
|
|
|
run: |
|
|
|
|
gh issue create \
|
|
|
|
--title "Update version in Cargo.toml for $MILESTONE_VERSION" \
|
|
|
|
--label 'maintenance' \
|
|
|
|
--body-file $ISSUE_TEMPLATE \
|
|
|
|
--milestone $MILESTONE_VERSION
|
|
|
|
|
2024-03-21 15:49:25 +01:00
|
|
|
create-update-openapi-issue:
|
|
|
|
needs: get-release-version
|
|
|
|
# Create the openAPI issue if the release is not only a patch release
|
|
|
|
if: github.event.action == 'created' && needs.get-release-version.outputs.is-patch == 'false'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
ISSUE_TEMPLATE: issue-template.md
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Download the issue template
|
|
|
|
run: curl -s https://raw.githubusercontent.com/meilisearch/engine-team/main/issue-templates/update-openapi-issue.md > $ISSUE_TEMPLATE
|
|
|
|
- name: Create the issue
|
|
|
|
run: |
|
|
|
|
gh issue create \
|
|
|
|
--title "Update Open API file for $MILESTONE_VERSION" \
|
|
|
|
--label 'maintenance' \
|
|
|
|
--body-file $ISSUE_TEMPLATE \
|
|
|
|
--milestone $MILESTONE_VERSION
|
|
|
|
|
2022-09-02 16:22:21 +02:00
|
|
|
# ----------------
|
|
|
|
# MILESTONE CLOSED
|
|
|
|
# ----------------
|
|
|
|
|
|
|
|
create-release-label:
|
|
|
|
if: github.event.action == 'closed'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-09-03 17:53:37 +02:00
|
|
|
- name: Create the ${{ env.MILESTONE_VERSION }} label
|
2022-09-02 16:22:21 +02:00
|
|
|
run: |
|
|
|
|
label_description="PRs/issues solved in $MILESTONE_VERSION"
|
|
|
|
if [[ ! -z $MILESTONE_DUE_ON ]]; then
|
|
|
|
date=$(echo $MILESTONE_DUE_ON | cut -d 'T' -f 1)
|
|
|
|
label_description="$label_description released on $date"
|
|
|
|
fi
|
|
|
|
|
2022-10-04 16:26:15 +02:00
|
|
|
gh api repos/meilisearch/meilisearch/labels \
|
2022-09-02 16:22:21 +02:00
|
|
|
--method POST \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
|
|
|
-f name="$MILESTONE_VERSION" \
|
|
|
|
-f description="$label_description" \
|
|
|
|
-f color='ff5ba3'
|
|
|
|
|
|
|
|
labelize-all-milestone-content:
|
|
|
|
if: github.event.action == 'closed'
|
|
|
|
needs: create-release-label
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-09-03 17:53:37 +02:00
|
|
|
- name: Add label ${{ env.MILESTONE_VERSION }} to all PRs in the Milestone
|
2022-09-02 16:22:21 +02:00
|
|
|
run: |
|
|
|
|
prs=$(gh pr list --search milestone:"$MILESTONE_VERSION" --limit 1000 --state all --json number --template '{{range .}}{{tablerow (printf "%v" .number)}}{{end}}')
|
|
|
|
for pr in $prs; do
|
2022-10-04 16:35:06 +02:00
|
|
|
gh pr edit $pr --add-label $MILESTONE_VERSION
|
2022-09-02 16:22:21 +02:00
|
|
|
done
|
2022-09-03 17:53:37 +02:00
|
|
|
- name: Add label ${{ env.MILESTONE_VERSION }} to all issues in the Milestone
|
2022-09-02 16:22:21 +02:00
|
|
|
run: |
|
|
|
|
issues=$(gh issue list --search milestone:"$MILESTONE_VERSION" --limit 1000 --state all --json number --template '{{range .}}{{tablerow (printf "%v" .number)}}{{end}}')
|
|
|
|
for issue in $issues; do
|
|
|
|
gh issue edit $issue --add-label $MILESTONE_VERSION
|
|
|
|
done
|