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

fix changelog generation in release #12

Closed
wants to merge 2 commits into from
Closed
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
22 changes: 14 additions & 8 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ jobs:
with:
fetch-depth: 0

- name: Get latest tag
id: get_latest_tag
# Incrementing the version in package.json allows us to bump the major or minor version by bumping the version in the package.json file to X.X.-1
- name: Get latest tag from package.json
id: latest_tag_package_json
run: echo "LATEST_TAG=v$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT

# Use latest tag from github tag history to generate the changelog
- name: Get latest tag from tag history
id: latest_tag
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 || echo v0.0.0)" >> $GITHUB_OUTPUT

- name: Increment version
id: increment_version
run: |
Expand All @@ -39,7 +45,7 @@ jobs:
echo "NEW_VERSION=v$new_version" >> $GITHUB_OUTPUT
fi
env:
LATEST_TAG: ${{ steps.get_latest_tag.outputs.LATEST_TAG }}
LATEST_TAG: ${{ steps.latest_tag_package_json.outputs.LATEST_TAG }}

- name: Update package.json version
run: |
Expand All @@ -65,10 +71,10 @@ jobs:
- name: Generate changelog
id: generate_changelog
run: |
echo "Debug: Latest tag is ${{ steps.get_latest_tag.outputs.LATEST_TAG }}"
echo "Debug: Latest tag is ${{ steps.latest_tag.outputs.LATEST_TAG }}"

changelog=""
if [[ "${{ steps.get_latest_tag.outputs.LATEST_TAG }}" == "v0.0.0" ]]; then
if [[ "${{ steps.latest_tag.outputs.LATEST_TAG }}" == "v0.0.0" ]]; then
echo "Debug: No previous tag found, getting all changes in src directory"
git diff --name-status $(git hash-object -t tree /dev/null)

Expand All @@ -90,9 +96,9 @@ jobs:
fi
done < <(git diff --name-status $(git hash-object -t tree /dev/null))
else
echo "Debug: Previous tag found, getting changes since ${{ steps.get_latest_tag.outputs.LATEST_TAG }}"
git diff --name-status ${{ steps.get_latest_tag.outputs.LATEST_TAG }}

echo "Debug: Previous tag found, getting changes since ${{ steps.latest_tag.outputs.LATEST_TAG }}"
git diff --name-status ${{ steps.latest_tag.outputs.LATEST_TAG }}
while IFS= read -r line; do
status=$(echo $line | cut -d' ' -f1)
file=$(echo $line | cut -d' ' -f2-)
Expand All @@ -107,7 +113,7 @@ jobs:
changelog+="- $action [$file](https://github.com/${{ github.repository }}/commit/${{ github.sha }}#diff-$(echo -n $file | sha256sum | cut -d' ' -f1))"$'\n'
echo "Debug: Added to changelog: $action $file"
fi
done < <(git diff --name-status ${{ steps.get_latest_tag.outputs.LATEST_TAG }})
done < <(git diff --name-status ${{ steps.latest_tag.outputs.LATEST_TAG }})
fi

echo "Debug: Final changelog:"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uniswap/briefcase",
"version": "0.1.0",
"version": "0.1.-1",
"description": "Smart contract interfaces of Uniswap protocol smart contracts",
"repository": {
"type": "git",
Expand Down
Loading