This repo provides a method to update another repos book.json
based on values sourced from a helm repo search. When there this action is run it will get the latest non dev helm versions from a specified repo and will then map those to a given book.json. These are then pushed to a new branch on the target repo and a pr is opened.
- github deploy token
- helm repo with published charts
- github account, destination repo and source repo (this is source)
- book.json in destination repo
This job will look at a helm repo and parse the info into a file chart-versions.json
this will be of the form:
{
"chart1_name": "1.2.3",
"chart2_name": "2.3.4",
"chart3_name": "3.4.5"
}
This job will pull in all charts in that repo. This allows the next job to be dynamically built out if we add charts.
Note this workflow does not include dev charts. This job also strips the repo away from the name since
helm search repo x
stores the name as<local_repo>/<chart_name>
(ex:greymatter/fabric
). This chart replacesagent
andserver
withspire_agent
andspire_server
as those are the variables used in the gitbook repo.
The chart is passed from one runner to another runner by storing it in an artifact chart-versions
Here is where the super fancy stuff begins. This job pulls in the destination repo, rebuilds book.json
using the versions we sourced in the prior job. If there are any changes the job then creates a branch and pr in the gitbook repo.
Since the first job gets all the charts in the repo we can quickly expand the variables published to gitbook. To do so, update gitbook with a key, add that key to the CHARTS
environment variable in the create_pr
job (space separated array). If the chart name matches the variable name in gitbook then you're good; otherwise, you'll need to add a sed
in the get-current-chart-release-versions
job to massage the chart-versions.json
artifact. If the key is in cts
but not in gitbook any changes will not be reflected in the destination repo pr.
If you want to use this workflow with a non default branch then set the BRANCH_TO_UPDATE
to the desired branch in the create_pr
job.
To get this to work you will need to add a deploy token to your pushing repo:
- click your profile in github then settings > developer settings > personal access tokens
- create a new token with "write:packages" and "repo" and "read:org"
- copy the generated token
- in the pushing repo go to settings > secrets > New repository secret and create a secret "deploy_token" and paste in the generated toke from the last step
- in the github action reference it with `${{ secrets.deploy_token }}.