Skip to content

Commit

Permalink
feat(ci): various adjustments (#967)
Browse files Browse the repository at this point in the history
- **fix(ci):
https://github.com/teutonet/teutonet-helm-charts/actions/runs/9109565794/job/25042726458#step:4:1**
- **feat(ci): auto-generate sources for charts**
- **feat(ci): push images using GITHUB_TOKEN this should set the images
to public by default, see https://stackoverflow.com/a/77094666**
- **chore(ci): remove deprecated repo, only OCI is supported**
  • Loading branch information
cwrau authored Aug 1, 2024
1 parent 8b1f815 commit 23144a3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/create-release-prs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ jobs:
if: ${{ steps.release-please.outputs.prs_created == 'true' }}
- name: Set PRs to auto-merge
if: ${{ steps.release-please.outputs.prs_created == 'true' }}
env:
GH_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN }}
run: |
for pr_number in ${PR_NUMBERS};do
PRs=( ${{ join(fromJSON(steps.release-please.outputs.prs).*.number, ' ') }} )
for pr_number in "${PRs[@]}";do
gh pr merge --auto --squash "$pr_number"
done
env:
GH_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN }}
PR_NUMBERS: ${{ join(fromJSON(steps.release-please.outputs.prs).*.number, ' ') }}
merge-method: squash
4 changes: 2 additions & 2 deletions .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- run: helm package --dependency-update "${CHART}"
- run: helm registry login ghcr.io --username teutonet-bot --password ${{ secrets.ACTIONS_BOT_TOKEN }}
- run: helm registry login ghcr.io --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }}
- run: helm push -- *.tgz "oci://ghcr.io/${GITHUB_REPOSITORY}"
- run: oras login ghcr.io --username teutonet-bot --password ${{ secrets.ACTIONS_BOT_TOKEN }}
- run: oras login ghcr.io --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }}
- run: oras push "ghcr.io/${GITHUB_REPOSITORY}/${CHART#charts/}:artifacthub.io" --config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml .github/artifacthub-repo.yaml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
abort:
runs-on: ubuntu-latest
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/release-update-metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,30 @@ jobs:
- name: Install sponge
run: sudo apt-get -yq install moreutils

- name: set sources in Chart.yaml
run: |
set -ex
version="$(jq -er --arg chart "${CHART}" '.["charts/\($chart)"]' .github/release-please/manifest.json)"
#shellcheck disable=SC2016
yq -e -y -S -i --arg tagSource "https://github.com/${GITHUB_REPOSITORY}/tree/${CHART}-v${version}/charts/${CHART}" --arg branchSource "https://github.com/${GITHUB_REPOSITORY}/tree/${{ github.event.repository.default_branch }}/charts/${CHART}" '.sources=[$tagSource, $branchSource]' "charts/${CHART}/Chart.yaml"
- name: Commit Chart.yaml
uses: EndBug/add-and-commit@v9
with:
message: "ci: [bot] Update sources in 'Chart.yaml'"
default_author: github_actions
push: true
add: charts/${{ env.CHART }}/Chart.yaml

- run: ./.github/scripts/prepare-values.sh "charts/$CHART"
- run: ./.github/scripts/extract-artifacthub-images.sh "charts/$CHART"

- run: ./.github/scripts/enforce-trusted-registries.sh "charts/$CHART"

- name: Commit artifacthub images
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
message: "ci: [bot] Update images in 'Chart.yaml'"
default_author: github_actions
push: false
add: charts/${{ needs.getChangedChart.outputs.chart }}/Chart.yaml
add: charts/${{ env.CHART }}/Chart.yaml

- run: pip install json-schema-for-humans
- name: generate values.md
Expand All @@ -53,12 +65,11 @@ jobs:
- name: generate Docs
uses: docker://jnorwood/helm-docs:latest@sha256:2b0681670e69ebd28163abdc276a419ef4a8c0ba9258699847a5ed001fd7de0e
with:
args: -g charts/${{ needs.getChangedChart.outputs.chart }}

args: -g charts/${{ env.CHART }}
- name: Commit README
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
message: "ci: [bot] Update 'README.md'"
default_author: github_actions
push: true
add: charts/${{ needs.getChangedChart.outputs.chart }}/README.md
add: charts/${{ env.CHART }}/README.md
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,7 @@ This chart deploys a TeutonetesCluster and all it's necessary infrastructure com
[Helm](https://helm.sh) must be installed to use the charts.
Please refer to Helm's [documentation](https://helm.sh/docs/) to get started.

Once Helm is set up properly, add the repo as follows:

```console
helm repo add teutonet https://teutonet.github.io/teutonet-helm-charts
```

You can then run `helm search repo teutonet` to see the charts.

Or you can use the new OCI registry; `oci://ghcr.io/teutonet/teutonet-helm-charts`
You can use the OCI registry; `oci://ghcr.io/teutonet/teutonet-helm-charts`

## License

Expand Down

0 comments on commit 23144a3

Please sign in to comment.