Skip to content

feat(release workflow): make changelog range clickable link to diffs #20

feat(release workflow): make changelog range clickable link to diffs

feat(release workflow): make changelog range clickable link to diffs #20

Workflow file for this run

name: Release Workflow
on:
push:
branches:
- main-workable
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install AWS SAM CLI
run: pip install aws-sam-cli
- name: Build with SAM
run: sam build --use-container
- name: Zip the contents
id: zip
run: |
release_suffix=$(date -u +"%Y%m%d%H%M")
echo "release_suffix=${release_suffix}" >> $GITHUB_OUTPUT
zip_name="apache-iceberg-monitoring-${release_suffix}.zip"
cd .aws-sam/build/IcebergMetricsLambda
zip -r "../../../${zip_name}" .
echo "zip_name=${zip_name}" >> $GITHUB_OUTPUT
- name: Generate changelog with commit links
id: changelog
run: |
repo_url="https://github.com/${{ github.repository }}"
git fetch --prune --unshallow
previous_tag=$(git tag --sort=-creatordate | head -n 1)
current_sha=$(git rev-parse HEAD)
if [ -z "$previous_tag" ]; then
range=""
compare_url="${repo_url}/commit/${current_sha}"
changelog="Commit changes for [HEAD](${compare_url}):"$'\n'
log_range="HEAD"
else
range="${previous_tag}..${current_sha}"
display_range="${previous_tag}..HEAD"
compare_url="${repo_url}/compare/${previous_tag}...${current_sha}"
changelog="Commit changes for [${display_range}](${compare_url}):"$'\n'
log_range="${previous_tag}..${current_sha}"
fi
while read -r hash message; do
changelog="${changelog}* [${message}](${repo_url}/commit/${hash})"$'\n'
done < <(git log ${log_range} --pretty=format:"%H %s"; echo "")
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$changelog" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release and Upload Asset (gh CLI)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create the release
gh release create "apache-iceberg-monitoring-${{ steps.zip.outputs.release_suffix }}" \
--title "apache-iceberg-monitoring-${{ steps.zip.outputs.release_suffix }}" \
--notes "${{ steps.changelog.outputs.changelog }}" \
--target ${{ github.sha }} \
./${{ steps.zip.outputs.zip_name }}