Skip to content

Add the support to release to a different repository#215

Open
davidebianchi wants to merge 1 commit into
helm:mainfrom
kube-green:main
Open

Add the support to release to a different repository#215
davidebianchi wants to merge 1 commit into
helm:mainfrom
kube-green:main

Conversation

@davidebianchi
Copy link
Copy Markdown

With the changes in this PR, it is possible to have the chart in a github repository and publish a release in another repository.

The added inputs are:

  • owner
  • repo
  • commit: this needs to address to the correct sha or branch where to create the release (it is not correct to use the git rev-parse HEAD command in this use case, since the release will be created in another repo)
  • workdir: enable the action to work with multiple checked out repositories

The follow is an example github actions to achieve this (I can also put it in the README if it could be interesting):

name: Helm Chart Releaser
on:
  push:
    branches:
      - main
jobs:
  release:
    runs-on: ubuntu-latest
    env:
      OWNER: "OWNER"
    steps:
      - uses: actions/checkout@v4
        with:
          path: main-repo
      - uses: actions/checkout@v4
        with:
          repository: ${{ env.OWNER }}/helm-charts
          path: helm-charts
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - name: Setup Helm
        uses: azure/setup-helm@v4
      - name: Run chart-releaser to create release
        uses: helm/chart-releaser-action@main
        env:
          CR_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
        with:
          owner: ${{ env.OWNER }}
          repo: helm-charts
          pages_branch: main
          commit: main
          skip_upload: true
          workdir: main-repo
      - name: Update index.yaml
        working-directory: helm-charts
        run: |
          git config user.name "${{ github.actor }}"
          git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
          cr index -o ${{ env.OWNER }} -r helm-charts --package-path ../main-repo/.cr-release-packages --pages-branch main --index-path . --push

It is needed to change the OWNER env with the correct repo owner.

The flow with this action is:

  • checkout the repo which contains the chart
  • checkout the repo where to upload the chart using a token with the permission to push in this repo
  • create the release
  • upload the index.yaml

Signed-off-by: Davide Bianchi <bianchidavide12@gmail.com>
@davidebianchi
Copy link
Copy Markdown
Author

This PR is partially covered also by #195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant