googleapis / release-please-action

automated releases based on conventional commits
Apache License 2.0
1.61k stars 207 forks source link

Question: Create documentation during release with new version number #927

Closed MoJo2600 closed 7 months ago

MoJo2600 commented 7 months ago

I want to use this action with a helm chart. There is a tool called helm-docs which can generate the documentation automatically from the sources and will include the version of the chart from a file called Chart.yaml. I set up release-please-action to use the helm strategy to update this file and this is working well.

My question is now, if there is a way to run a step to generate the documentation with the new version number release-please will determine and add the generated files to the release commit?

I know that I can add extra files and use the comment keywords like x-release-please-start-... to have release-please update the version numbers. But this is not working correctly in my case. It fails to update the version number in one place.

If I do add a step to generate the documentation after the release-please step, a new commit will be created with the correct documentation, but this commit is ahead of the release commit.

I tried to split the release-please action with the skip parameters. But it seems there is no way to get the version number without release-please also tagging the commit.

Please close this issue if it does not fit in here.

MoJo2600 commented 7 months ago

Ok, I think I figured it out on my own. Just for the record. I created another workflow which is triggered if something is pushed to a branch starting with release-*. In this workflow I generate the documentation and commit it back to the branch. This commit is then added to the pull request.

name: prepare-release
on:
  push:
    branches:
      - release-*

permissions:
  contents: write
  pull-requests: write

jobs:
  prepare-dist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Generate documentation
        id: generate-documentation
        run: |
          docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest

      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: 'chore(documentation): Update documentation'
MoJo2600 commented 7 months ago

resolved