enonic / release-tools

Enonic Release Tools
2 stars 0 forks source link

generate-changelog action does not find commits for final release #36

Closed rymsha closed 3 years ago

rymsha commented 3 years ago
  release_notes:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Get previous release tag
        id: get_previous_release_tag
        run: |
          PREVIOUS_RELEASE_TAG=$(git tag --sort=-version:refname --merged | grep -E '^v([[:digit:]]+\.){2}[[:digit:]]+$' | head -1)
          echo ::set-output name=previous_release_tag::$PREVIOUS_RELEASE_TAG
      - name: Generate Release Notes
        uses: enonic/release-tools/generate-changelog@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ZENHUB_TOKEN: ${{ secrets.ZENHUB_TOKEN }}
          PREVIOS_RELEASE_TAG: ${{ steps.get_previous_release_tag.outputs.previous_release_tag }}
          OUTPUT_FILE: changelog.md

      - uses: actions/upload-artifact@v2
        with:
          name: changelog
          path: changelog.md

Now when release happens on tag PREVIOUS_RELEASE_TAG finds the current tag, with 0 commits after it, hence no changes.

Other apps use similar changelog procedure, but tagging happens automatically (release happens on push, not on tag), and GH Action can pick up changes.

rymsha commented 3 years ago

Probable fix - look deeper in get_previous_release_tag if tag found is actual head

rymsha commented 3 years ago

PREVIOUS_RELEASE_TAG=$(git tag --sort=-version:refname --merged | grep -E '^v([[:digit:]]+\.){2}[[:digit:]]+$' | grep -v "$(git describe --tags)" | head -1) should do the trick