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

BREAKING CHANGE: Release V2.0.0 #105

Merged
merged 41 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f1c0b63
docs: start drafting logging architecture
Jun 21, 2024
3dbd64b
docs: add apm config and example usage
Jun 21, 2024
f997393
docs: logging sequence diagram
Jun 21, 2024
75309e4
docs: reorder sequence diagram notes
Jun 21, 2024
bcecb59
docs: add log event sequence diagram
Jun 21, 2024
05e5c29
docs: add kibana apps
Jun 21, 2024
aa6848d
docs: link resources to go through before reading docs
Jun 26, 2024
83c15b3
docs: reference installation docs for external services
Jun 26, 2024
f5e65df
docs: update logging docs
Jul 1, 2024
7d1b9da
docs: fix intro
Jul 1, 2024
e42dad1
docs: add table of contents for logs
Jul 1, 2024
d31b4cf
docs: add missing images for elastic setup
Jul 1, 2024
ffb3274
docs: add missing images for logging data view
Jul 1, 2024
83135ea
docs: fix broken links in data view
Jul 1, 2024
44a60c1
docs: reference logging data view in user guide
Jul 1, 2024
3876898
Update env registry
Lenbkr Jul 3, 2024
c7a8e76
Merge pull request #84 from frmscoe/docs/logs
rtkay123 Jul 8, 2024
0444c53
docs: add list management research
Sandy-at-Tazama Jul 9, 2024
2ba1704
docs: updated images
Justus-at-Tazama Jul 10, 2024
2301f1c
docs: fixed grammar
Justus-at-Tazama Jul 10, 2024
0c8becf
docs: updated image
Justus-at-Tazama Jul 10, 2024
762b6fc
docs: add missing image
Justus-at-Tazama Jul 10, 2024
d24a61e
docs: updated broken link
Justus-at-Tazama Jul 10, 2024
032a4f7
Merge pull request #92 from frmscoe/config-db-rename
Justus-at-Tazama Jul 10, 2024
2288cc0
Merge pull request #95 from frmscoe/20240710-udpate-entity-resolution…
Sandy-at-Tazama Jul 10, 2024
4face21
docs: contribution guide update with style guide and coding practices
Sandy-at-Tazama Jul 11, 2024
727d6c3
Merge pull request #96 from frmscoe/240708-contribution-guide
Justus-at-Tazama Jul 11, 2024
0ca7b0a
docs: configuration managment update
Sandy-at-Tazama Jul 12, 2024
9afc2bd
docs: remove channel
Sandy-at-Tazama Jul 12, 2024
3f50192
Merge pull request #97 from frmscoe/240712-configuration-management
Justus-at-Tazama Jul 12, 2024
ef2644e
docs: update to remove channel
Sandy-at-Tazama Jul 12, 2024
dbfed8f
docs: update rule lifecycle -add image
Sandy-at-Tazama Jul 12, 2024
7823711
docs: update creating processors - link to config management
Sandy-at-Tazama Jul 12, 2024
01aadc7
Merge pull request #98 from frmscoe/240712-channel-changes
Justus-at-Tazama Jul 12, 2024
541b356
docs: update crsp to ed
Sandy-at-Tazama Jul 15, 2024
3265bbb
Merge pull request #101 from frmscoe/240715-full-service-crsp
Justus-at-Tazama Jul 15, 2024
a7b3be6
docs: remove duplidate contribution guide and replace with link
Sandy-at-Tazama Jul 15, 2024
59c60a3
docs: remove duplicate code of conduct and replace with link
Sandy-at-Tazama Jul 15, 2024
0399388
Merge pull request #102 from frmscoe/240715-contrib-guide-update
Justus-at-Tazama Jul 15, 2024
6021261
feat: Enhancement to the release workflow
vorsterk Jul 17, 2024
d843385
Merge pull request #104 from frmscoe/release
vorsterk Jul 17, 2024
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
39 changes: 39 additions & 0 deletions .github/workflows/milestone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-License-Identifier: Apache-2.0

name: Milestone Workflow

on:
workflow_dispatch:
inputs:
milestoneId:
description: 'Milestone ID'
required: true
default: '1'

jobs:
close_milestone:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Close Milestone
run: |
ACCESS_TOKEN="${{ secrets.GITHUB_TOKEN }}"
MILESTONE_NUMBER=${{ github.event.inputs.milestoneId }}
API_URL="https://api.github.com"

curl -X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{"state": "closed"}' \
$API_URL/repos/${{ github.repository }}/milestones/$MILESTONE_NUMBER

- name: Trigger Release Workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
event-type: release
client-payload: '{"milestone_number": "${{ github.event.inputs.milestoneId }}"}'
272 changes: 246 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,257 @@
# SPDX-License-Identifier: Apache-2.0

# Please do not attempt to edit this flow without the direct consent from the Tazama team. This file is managed centrally.

# This workflow should only be run when while on the main branch
# Create a tag locally using "git tag vx.x.x" supposed to match latest version in changelog.md
# Then push the release tag created above by running "git push origin vx.x.x"
# The tag will be set on the release page on github with changes made

name: Create a New Release
name: Release Workflow

on:
push:
tags:
- "v*"

permissions:
contents: write
repository_dispatch:
types: [release]
properties:
milestone_number:
type: string

jobs:
release:
name: Release pushed tag
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Create release
# Checkout the main branch with all history
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0 # Fetch all tags

# Fetch merged pull request and determine release labels
- uses: actions-ecosystem/action-get-merged-pull-request@v1
id: get-merged-pull-request
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions-ecosystem/action-release-label@v1
id: release-label
if: ${{ steps.get-merged-pull-request.outputs.title != null }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

# Get the latest tag in the repository
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
if: ${{ steps.release-label.outputs.level != null }}
with:
semver_only: true

# Determine the release type (major, minor, patch) based on commit messages
- name: Determine Release Type
id: determine_release
run: |
PREV_VERSION=$(git describe --abbrev=0 --tags)
echo "Previous Version: $PREV_VERSION"

COMMIT_MESSAGES=$(git log $PREV_VERSION^..HEAD --format=%B)
echo "Commit Messages: $COMMIT_MESSAGES"

# Determine release type based on commit messages and labels
RELEASE_TYPE="patch" # Default to patch

if echo "$COMMIT_MESSAGES" | grep -q -e "BREAKING CHANGE:"; then
RELEASE_TYPE="major"
elif echo "$COMMIT_MESSAGES" | grep -q -e "feat!:"; then
RELEASE_TYPE="major"
elif echo "$COMMIT_MESSAGES" | grep -q -e "feat:"; then
RELEASE_TYPE="minor"
elif echo "$COMMIT_MESSAGES" | grep -q -e "feat:" && (echo "$COMMIT_MESSAGES" | grep -q -e "fix:" || echo "$COMMIT_MESSAGES" | grep -q -e "enhancement:" || echo "$COMMIT_MESSAGES" | grep -q -e "docs:" || echo "$COMMIT_MESSAGES" | grep -q -e "refactor:" || echo "$COMMIT_MESSAGES" | grep -q -e "chore:"); then
RELEASE_TYPE="minor"
elif echo "$COMMIT_MESSAGES" | grep -q -e "fix:" -e "enhancement:" -e "docs:" -e "refactor:" -e "chore:" -e "build:" -e "ci:" -e "perf:" -e "style:" -e "test:" -e "chore(deps):" -e "chore(deps-dev):"; then
RELEASE_TYPE="patch"
fi

echo "Release Type: $RELEASE_TYPE"
echo "::set-output name=release_type::$RELEASE_TYPE"

# Bump the version based on the determined release type
- name: Bump Version
id: bump_version
run: |
PREV_VERSION=$(git describe --abbrev=0 --tags)
echo "Previous Version: $PREV_VERSION"

RELEASE_TYPE=${{ steps.determine_release.outputs.release_type }}
echo "Release Type: $RELEASE_TYPE"

# Strip the 'v' from the version if it exists
PREV_VERSION=${PREV_VERSION#v}

IFS='.' read -r MAJOR MINOR PATCH <<< "$PREV_VERSION"

if [[ $RELEASE_TYPE == "major" ]]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [[ $RELEASE_TYPE == "minor" ]]; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
fi

NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
echo "New Version: $NEW_VERSION"
echo "::set-output name=new_version::$NEW_VERSION"

# Get the milestone details
- name: Get Milestone Details
id: get_milestone
run: |
# Retrieve the milestone ID from the workflow input
MILESTONE_ID=${{ github.event.client_payload.milestone_number }}
MILESTONE_RESPONSE=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/milestones/${MILESTONE_ID}")
MILESTONE_TITLE=$(echo "$MILESTONE_RESPONSE" | jq -r '.title')
MILESTONE_DESCRIPTION=$(echo "$MILESTONE_RESPONSE" | jq -r '.description')
MILESTONE_DATE=$(echo "$MILESTONE_RESPONSE" | jq -r '.due_on')
echo "::set-output name=milestone_title::$MILESTONE_TITLE"
echo "::set-output name=milestone_description::$MILESTONE_DESCRIPTION"
echo "::set-output name=milestone_date::$MILESTONE_DATE"

# Generate the changelog based on commit messages and labels
- name: Generate Changelog
id: generate_changelog
run: |
# Generate Changelog Script
# Constants
CHANGELOG_FILE="/home/runner/work/changelog.txt"
LABEL_BUG="fix:"
LABEL_FEATURE="feat:"
LABEL_ENHANCEMENT="enhancement:"
LABEL_DOCS="docs:"
LABEL_REFACTOR="refactor:"
LABEL_CHORE="chore:"
LABEL_BUILD="build:"
LABEL_CI="ci:"
LABEL_PERFORMANCE="perf:"
LABEL_STYLE="style:"
LABEL_TEST="test:"
LABEL_BREAKING_CHANGE="BREAKING CHANGE:"
LABEL_FEAT_BREAKING="feat!:"
LABEL_DEPS="chore(deps):"
LABEL_DEPS_DEV="chore(deps-dev):"
# Get the last release tag
LAST_RELEASE_TAG=$(git describe --abbrev=0 --tags)
echo "Last Release Tag: $LAST_RELEASE_TAG"
# Get the milestone details from the output of the previous step
MILESTONE_TITLE="${{ steps.get_milestone.outputs.milestone_title }}"
MILESTONE_DESCRIPTION="${{ steps.get_milestone.outputs.milestone_description }}"
MILESTONE_DATE="${{ steps.get_milestone.outputs.milestone_date }}"
# Append the milestone details to the changelog file
echo "## Milestone: $MILESTONE_TITLE" >> "$CHANGELOG_FILE"
echo "Date: $MILESTONE_DATE" >> "$CHANGELOG_FILE"
echo "Description: $MILESTONE_DESCRIPTION" >> "$CHANGELOG_FILE"
echo "" >> "$CHANGELOG_FILE"
# Function to append section to the changelog file
append_section() {
local section_title="$1"
local section_label="$2"
local section_icon="$3"
# Get the commit messages with the specified label between the last release and the current release
local commit_messages=$(git log --pretty=format:"- %s (Linked Issues: %C(yellow)%H%Creset)" "$LAST_RELEASE_TAG..HEAD" --grep="$section_label" --no-merges --decorate --decorate-refs=refs/issues)
# If there are commit messages, append the section to the changelog file
if [ -n "$commit_messages" ]; then
# Remove duplicate commit messages
local unique_commit_messages=$(echo "$commit_messages" | awk '!seen[$0]++')
echo "### $section_icon $section_title" >> "$CHANGELOG_FILE"
echo "" >> "$CHANGELOG_FILE"
echo "$unique_commit_messages" >> "$CHANGELOG_FILE"
echo "" >> "$CHANGELOG_FILE"
fi
}
# Append sections to the changelog file based on labels
append_section "Bug Fixes" "$LABEL_BUG" "🐞"
append_section "New Features" "$LABEL_FEATURE" "⭐️"
append_section "Enhancements" "$LABEL_ENHANCEMENT" "✨"
append_section "Documentation" "$LABEL_DOCS" "📚"
append_section "Refactorings" "$LABEL_REFACTOR" "🔨"
append_section "Chores" "$LABEL_CHORE" "⚙️"
append_section "Build" "$LABEL_BUILD" "🏗️"
append_section "CI" "$LABEL_CI" "⚙️"
append_section "Performance" "$LABEL_PERFORMANCE" "🚀"
append_section "Style" "$LABEL_STYLE" "💅"
append_section "Tests" "$LABEL_TEST" "🧪"
append_section "Breaking Changes" "$LABEL_BREAKING_CHANGE" "💥"
append_section "Feature Breaking Changes" "$LABEL_FEAT_BREAKING" "💥"
append_section "Dependencies" "$LABEL_DEPS" "📦"
append_section "Dev Dependencies" "$LABEL_DEPS_DEV" "🔧"

# Function to append non-labeled commits to the changelog file
append_non_labeled_commits() {
# Get the commit messages that do not match any conventional commit labels between the last release and the current release
local non_labeled_commit_messages=$(git log --pretty=format:"- %s (Linked Issues: %C(yellow)%H%Creset)" "$LAST_RELEASE_TAG..HEAD" --invert-grep --grep="^fix:\|^feat:\|^enhancement:\|^docs:\|^refactor:\|^chore:\|^build:\|^ci:\|^perf:\|^style:\|^test:\|^BREAKING CHANGE:\|^feat!:\|^chore(deps):\|^chore(deps-dev):")
# If there are non-labeled commit messages, append the section to the changelog file
if [ -n "$non_labeled_commit_messages" ]; then
# Remove duplicate commit messages
local unique_commit_messages=$(echo "$non_labeled_commit_messages" | awk '!seen[$0]++')
echo "### 📝 Other Changes" >> "$CHANGELOG_FILE"
echo "" >> "$CHANGELOG_FILE"
echo "$unique_commit_messages" >> "$CHANGELOG_FILE"
echo "" >> "$CHANGELOG_FILE"
fi
}
# Append non-labeled commits to the changelog file
append_non_labeled_commits

echo "::set-output name=changelog_file::$CHANGELOG_FILE"

# Read changelog contents into a variable
- name: Read Changelog Contents
id: read_changelog
run: |
echo "::set-output name=changelog_contents::$(cat /home/runner/work/changelog.txt)"

# Display changelog
- name: Display Changelog
run: cat /home/runner/work/changelog.txt

# Attach changelog as an artifact
- name: Attach Changelog to Release
uses: actions/upload-artifact@v2
with:
name: Changelog
path: /home/runner/work/changelog.txt

# Create release while including the changelog
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
with:
tag_name: ${{ steps.bump_version.outputs.new_version }}
release_name: ${{ steps.bump_version.outputs.new_version }}
body_path: /home/runner/work/changelog.txt
draft: false
prerelease: false

# Update the CHANGELOG.md file in the repository
- name: Update CHANGELOG.md
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${tag#v}" \
--generate-notes

# Usage (while on main branch)
# git tag v1.0.0
# git push origin v1.0.0
NEW_VERSION=${{ steps.bump_version.outputs.new_version }}
CHANGELOG_CONTENTS=$(cat /home/runner/work/changelog.txt)
# Prepend the new changelog content to the existing CHANGELOG.md below SPDX-License-Identifier section
echo -e "$(head -n 2 CHANGELOG.md)\n\n## $NEW_VERSION\n\n$CHANGELOG_CONTENTS\n\n$(tail -n +3 CHANGELOG.md)" > CHANGELOG.md
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "chore: Update CHANGELOG.md for $NEW_VERSION"
git push origin HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Update the VERSION file
- name: Update VERSION file
run: |
NEW_VERSION=${{ steps.bump_version.outputs.new_version }}
echo -e "# SPDX-License-Identifier: Apache-2.0\n\n$NEW_VERSION" > VERSION
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION
git commit -m "chore: Update VERSION to $NEW_VERSION"
git push origin HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading