Creating releases with changelogs on GitHub Actions

I’m trying to use GitHub Actions to create releases (which works) but I would like to add the contents of our CHANGELOG.md to the release.

The pro has a file in the root with this kind of contents gist:2f3c96d718e227f1e577f8fb9ab1a695 · GitHub

And my actions look like this:

      - name: Release notes
        id: releasenotes
        run: |
          echo "::set-output name=releasenotes::$(cat ./CHANGELOG.md)"

      - name: Release
        uses: docker://replicated/vendor-cli:latest
        with:
          args: release create -y --lint --promote Unstable --version ${{ steps.release.outputs.version }} --yaml-dir=kots/manifests --release-notes "${{ steps.releasenotes.outputs.releasenotes }}"
        env:
          REPLICATED_APP: settlemint-bpaas
          REPLICATED_API_TOKEN: ${{ secrets.REPLICATED_API_TOKEN }}
          GITHUB_BRANCH_NAME: ${{ env.GITHUB_REF_SLUG }}
          GITHUB_TAG_NAME: ${{needs.test.outputs.version}}

But for some reason, the release changeling only has the first line while the variable does contain everything. So something goes wrong in passing the string with newlines.

Anyone did this before?

Would be cool if there was a --release-notes-file argument and delegate this to the cli

1 Like

Ok, took me way too long for such an unimportant thing, but I like it. The issue was a combo of how GHA does multiline and using the docker vendor cli.

      - name: Release
        id: release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: |
          rm -Rf ./CHANGELOG.md
          pnpm semantic-release

      - name: Release Replicated
        run: |
          curl -o install.sh -sSL https://raw.githubusercontent.com/replicatedhq/replicated/master/install.sh
          sudo bash ./install.sh
          replicated release create -y --lint --promote ${{ env.GITHUB_REF_SLUG == 'staging' && 'Unstable' || 'Beta' }} --version ${{ steps.release.outputs.version }} --yaml-dir=kots/manifests --release-notes "$(cat ./CHANGELOG.md)"
          replicated installer create -y --promote ${{ env.GITHUB_REF_SLUG == 'staging' && 'Unstable' || 'Beta' }} --yaml-file kots/kurl-installer.yaml
        env:
          REPLICATED_APP: settlemint-bpaas
          REPLICATED_API_TOKEN: ${{ secrets.REPLICATED_API_TOKEN }}
          GITHUB_BRANCH_NAME: ${{ env.GITHUB_REF_SLUG }}
          GITHUB_TAG_NAME: ${{ steps.release.outputs.version }}
1 Like