diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index 8e699e6..e5ed6be 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -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: | @@ -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: | @@ -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) @@ -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-) @@ -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:" diff --git a/package.json b/package.json index 2c3f63c..36fb327 100644 --- a/package.json +++ b/package.json @@ -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",