-
Notifications
You must be signed in to change notification settings - Fork 13
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
[MTG-1360] release process #431
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
25782a9
chore: set an appropriate 0.1 version
StanChe 8116b86
chore(ci): standardize release workflows and branch naming
StanChe 73ff1d4
chore: cliff.toml nit and makefile cleanup
StanChe 1ec3706
chore(ci): improve GitHub workflows for release process
StanChe 50596f4
chore(ci): use proper checkout action
StanChe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Finalize Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
|
||
# Add permissions for GitHub operations | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
finalize-release: | ||
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history for proper tagging | ||
|
||
- name: Setup Git Identity | ||
run: | | ||
set -e | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: Download changelog artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: changelog | ||
path: . | ||
|
||
- name: Get release version | ||
id: get_version | ||
run: | | ||
set -e | ||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
# We only support release/v* format now | ||
VERSION=${BRANCH_NAME#release/} | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
echo "tag_name=$VERSION" >> $GITHUB_OUTPUT | ||
- name: Create and push tag | ||
run: | | ||
set -e | ||
git tag -a ${{ steps.get_version.outputs.tag_name }} -m "Release ${{ steps.get_version.outputs.tag_name }}" | ||
git push origin ${{ steps.get_version.outputs.tag_name }} | ||
# This tag push will automatically trigger the docker.yml workflow for building images | ||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ steps.get_version.outputs.tag_name }} | ||
name: Release ${{ steps.get_version.outputs.tag_name }} | ||
body_path: CHANGELOG.md # Use the downloaded changelog | ||
generate_release_notes: false # We're using our own changelog | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Create PR to develop | ||
run: | | ||
set -e | ||
gh pr create --base develop --head ${{ github.event.pull_request.head.ref }} \ | ||
--title "Merge ${{ github.event.pull_request.head.ref }} into develop" \ | ||
--body "Merge release branch into develop." | ||
- name: Merge into develop | ||
run: | | ||
set -e | ||
PR_NUMBER=$(gh pr list --head ${{ github.event.pull_request.head.ref }} --base develop --json number --jq '.[0].number') | ||
if [ -n "$PR_NUMBER" ]; then | ||
gh pr merge --repo ${{ github.repository }} --merge --auto $PR_NUMBER | ||
else | ||
echo "No PR found to merge into develop" | ||
exit 1 | ||
fi | ||
# --- Post-Release Version Bump --- | ||
|
||
- name: Checkout develop branch for version bump | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use: |
||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history for proper tagging | ||
ref: develop | ||
|
||
- name: Install dependencies for version bump | ||
run: | | ||
set -e | ||
sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
cargo install cargo-edit | ||
- name: Calculate and apply next development version | ||
id: calculate_next_version | ||
run: | | ||
set -e | ||
# Extract version without 'v' prefix | ||
RAW_VERSION=${{ steps.get_version.outputs.version }} | ||
VERSION_WITHOUT_V="${RAW_VERSION#v}" | ||
IFS='.' read -ra VERSION_PARTS <<< "$VERSION_WITHOUT_V" | ||
MAJOR="${VERSION_PARTS[0]}" | ||
MINOR="${VERSION_PARTS[1]}" | ||
PATCH=$((VERSION_PARTS[2] + 1)) # Increment the patch version | ||
NEXT_VERSION="${MAJOR}.${MINOR}.${PATCH}-dev" | ||
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT | ||
echo "Setting develop version to $NEXT_VERSION" | ||
# Update Cargo.toml versions | ||
find . -name "Cargo.toml" -type f -exec cargo set-version $NEXT_VERSION --manifest-path {} \; | ||
# Update any other version references | ||
if [ -f "VERSION" ]; then | ||
echo "$NEXT_VERSION" > VERSION | ||
fi | ||
# Commit and push the version bump directly to develop | ||
git add -A | ||
git commit -m "chore: bump version to $NEXT_VERSION [skip ci]" | ||
git push origin develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
name: Prepare Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version number (without v prefix, e.g. 0.5.0)' | ||
required: true | ||
type: string | ||
base_commit: | ||
description: 'Base commit SHA (leave empty to use latest develop)' | ||
required: false | ||
type: string | ||
default: '' | ||
|
||
# Add permissions for GitHub operations | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
prepare-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ inputs.version }} # Output the version for use in other jobs | ||
tag_name: v${{ inputs.version }} | ||
release_branch: release/v${{ inputs.version }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.base_commit || 'develop' }} | ||
fetch-depth: 0 # Fetch all history for changelog generation | ||
|
||
- name: Validate input version | ||
run: | | ||
set -e | ||
# Make sure the version follows semantic versioning format | ||
if ! echo "${{ inputs.version }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'; then | ||
echo "Error: Version must follow semantic versioning format (e.g., 0.5.0)" | ||
exit 1 | ||
fi | ||
- name: Setup Git Identity | ||
run: | | ||
set -e | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: Install dependencies | ||
run: | | ||
set -e | ||
sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
cargo install cargo-edit | ||
cargo install git-cliff | ||
- name: Create release branch | ||
run: | | ||
set -e | ||
# Using standardized format: release/v{version} | ||
RELEASE_BRANCH="release/v${{ inputs.version }}" | ||
echo "Creating branch $RELEASE_BRANCH" | ||
git checkout -b $RELEASE_BRANCH | ||
echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV | ||
- name: Update version numbers | ||
run: | | ||
set -e | ||
# Update Cargo.toml versions | ||
find . -name "Cargo.toml" -type f -exec cargo set-version ${{ inputs.version }} --manifest-path {} \; | ||
# Update any other version references (add any other files that contain version numbers) | ||
if [ -f "VERSION" ]; then | ||
echo "${{ inputs.version }}" > VERSION | ||
fi | ||
git add -A | ||
git commit -m "chore: bump version to ${{ inputs.version }}" | ||
- name: Generate changelog | ||
id: changelog | ||
run: | | ||
set -e | ||
# Generate changelog using git-cliff | ||
git-cliff --config cliff.toml --tag "v${{ inputs.version }}" --output CHANGELOG.md | ||
# Generate a shorter version for PR description | ||
git-cliff --config cliff.toml --tag "v${{ inputs.version }}" --strip header,footer > .changelog_content | ||
git add CHANGELOG.md | ||
git commit -m "docs: add changelog for v${{ inputs.version }}" | ||
- name: Verify changelog | ||
run: | | ||
set -e | ||
# Check that the changelog file exists and has content | ||
if [ ! -s CHANGELOG.md ]; then | ||
echo "Error: CHANGELOG.md is empty or does not exist" | ||
exit 1 | ||
fi | ||
# Check that the changelog contains the version we're releasing | ||
if ! grep -q "v${{ inputs.version }}" CHANGELOG.md; then | ||
echo "Error: CHANGELOG.md does not contain version v${{ inputs.version }}" | ||
echo "Contents of CHANGELOG.md:" | ||
cat CHANGELOG.md | ||
exit 1 | ||
fi | ||
# Check that the changelog has sections | ||
if ! grep -q "###" CHANGELOG.md; then | ||
echo "Warning: CHANGELOG.md does not contain any sections (###)" | ||
echo "This might be ok if there are no conventional commits, but please verify" | ||
fi | ||
echo "Changelog verification passed!" | ||
- name: Push release branch | ||
run: | | ||
set -e | ||
git push -u origin $RELEASE_BRANCH | ||
- name: Create Pull Request | ||
id: create-pr | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
base: main | ||
head: ${{ env.RELEASE_BRANCH }} | ||
title: "Release v${{ inputs.version }}" | ||
body-path: .changelog_content | ||
draft: false | ||
|
||
- name: PR info | ||
run: | | ||
set -e | ||
echo "Pull Request created: ${{ steps.create-pr.outputs.pull-request-url }}" | ||
echo "Please review the PR, make any necessary adjustments, and merge when ready." | ||
- name: Upload changelog artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: changelog | ||
path: CHANGELOG.md |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a dispatch for prod
using the same values:
secrets.DISPATCH_TOKEN_PROD
https://api.github.com/repos/adm-metaex/aura-config-prod/dispatches