Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the support to release to a different repository #215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidebianchi
Copy link

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

@davidebianchi
Copy link
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