Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
50 changes: 40 additions & 10 deletions .github/workflows/crates-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,22 @@ jobs:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo-workspaces
- name: Cache cargo tools
uses: actions/cache@v3
id: cache-cargo-workspaces
id: cache-cargo-tools
with:
path: ~/.cargo/bin/cargo-workspaces
key: cargo-workspaces-${{ runner.os }}-v1
path: |
~/.cargo/bin/cargo-workspaces
~/.cargo/bin/git-cliff
key: cargo-tools-${{ runner.os }}-v1
restore-keys: |
cargo-workspaces-${{ runner.os }}-
cargo-tools-${{ runner.os }}-

- name: Install cargo-workspaces
if: steps.cache-cargo-workspaces.outputs.cache-hit != 'true'
run: cargo install cargo-workspaces
- name: Install cargo tools
if: steps.cache-cargo-tools.outputs.cache-hit != 'true'
run: |
cargo install cargo-workspaces
cargo install git-cliff

- name: Setup Git
run: |
Expand All @@ -66,15 +70,41 @@ jobs:
FORCE_FLAG="--force '*'"
fi

CHANGED_CRATES=$(cargo workspaces changed)

if [[ -z "$CHANGED_CRATES" ]]; then
echo "No crates changed since last tag. Nothing to do."
exit 0
fi

case "$BRANCH" in
main)
cargo workspaces version --allow-branch "$BRANCH" --no-global-tag --yes $FORCE_FLAG
cargo workspaces version --allow-branch "$BRANCH" --no-global-tag --yes $FORCE_FLAG --no-git-push
;;
development)
cargo workspaces version --allow-branch "$BRANCH" --no-global-tag prerelease --pre-id "$PRE_ID" --yes $FORCE_FLAG
cargo workspaces version --allow-branch "$BRANCH" --no-global-tag prerelease --pre-id "$PRE_ID" --yes $FORCE_FLAG --no-git-push
;;
*)
echo "❌ This workflow can only be run on 'main' or 'development'."
exit 1
;;
esac

NEW_TAGS=$(git tag --points-at HEAD)
echo "Tags created locally:"
echo "$NEW_TAGS"

../../scripts/generate-changelogs.sh "$CHANGED_CRATES"

echo "Amending commit to include changelogs..."
git commit --amend --no-edit

for tag in $NEW_TAGS; do
echo "Re-applying tag $tag on amended commit..."
git tag -f "$tag"
done

git push origin "$BRANCH"
git push origin --tags

echo "✅ Version bump and changelogs pushed successfully!"
9 changes: 4 additions & 5 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,17 @@ jobs:
run: cargo publish -p quickmark-cli --token ${{ secrets.CRATES_IO_TOKEN }}

- name: Generate changelog
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --include-path "crates/quickmark-cli/**" --tag-pattern "quickmark-cli@*"
env:
OUTPUT: CHANGELOG.md
args: --include-path "crates/quickmark-cli/**" --tag-pattern "quickmark-cli@*" --latest

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
body: ${{ steps.changelog.outputs.content }}
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 3 additions & 5 deletions .github/workflows/release-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ jobs:
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --include-path "crates/quickmark-core/**" --tag-pattern "quickmark-core@*"
env:
OUTPUT: CHANGELOG.md
args: --include-path "crates/quickmark-core/**" --tag-pattern "quickmark-core@*" --latest

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
body: ${{ steps.changelog.outputs.content }}
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 10 additions & 17 deletions .github/workflows/release-server.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release QuickMark Server
name: Release QuickMark Server

on:
push:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
run: |
ARCHIVE_NAME="quickmark-server-${{ matrix.target }}.tar.gz"
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT

# Create archive with the binary renamed to quickmark-server
mkdir -p archive-temp
cp "target/${{ matrix.target }}/release/quickmark-server${{ matrix.suffix }}" archive-temp/quickmark-server${{ matrix.suffix }}
Expand Down Expand Up @@ -104,20 +104,6 @@ jobs:
- name: Publish quickmark-server to crates.io
run: cargo publish -p quickmark-server --token ${{ secrets.CRATES_IO_TOKEN }}

- name: Generate changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --include-path "crates/quickmark-server/**" --tag-pattern "quickmark-server@*"
env:
OUTPUT: CHANGELOG.md

- name: Upload changelog
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGELOG.md

release:
name: Create Release
needs: [build, publish]
Expand Down Expand Up @@ -149,11 +135,18 @@ jobs:
ls -la release-archives/
if [ -f CHANGELOG.md ]; then ls -la CHANGELOG.md; fi

- name: Generate changelog
id: changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --include-path "crates/quickmark-server/**" --tag-pattern "quickmark-server@*" --latest

- name: Create release
uses: softprops/action-gh-release@v2
with:
files: release-archives/*
body_path: CHANGELOG.md
body: ${{ steps.changelog.outputs.content }}
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
env:
Expand Down
31 changes: 31 additions & 0 deletions scripts/generate-changelogs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ $# -eq 0 ]]; then
echo "Usage: $0 <crate1> [<crate2> ...]"
exit 1
fi

REPO_ROOT=$(git rev-parse --show-toplevel)
cd "$REPO_ROOT"

for crate in "$@"; do
echo "Processing crate: $crate"

# Get crate manifest path from cargo metadata
CRATE_DIR=$(cargo metadata --format-version 1 --no-deps \
| jq -r --arg NAME "$crate" '.packages[] | select(.name==$NAME) | .manifest_path' \
| xargs dirname)

REL_CRATE_DIR=$(realpath --relative-to="$REPO_ROOT" "$CRATE_DIR")

echo "Generating changelog for $crate in $REL_CRATE_DIR..."
git cliff \
--tag-pattern "$crate@*" \
--include-path "$REL_CRATE_DIR/**" \
--output "$REL_CRATE_DIR/CHANGELOG.md"

git add "$REL_CRATE_DIR/CHANGELOG.md"
done

echo "✅ Changelogs staged for crates: $*"