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

[ALL CHARTS] Publish new charts to OCI registry #2631

Merged
merged 3 commits into from
Nov 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
release:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
packages: write # needed for ghcr access
id-token: write # needed for keyless signing

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -37,3 +39,32 @@ jobs:
uses: helm/chart-releaser-action@v1.4.1
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

# see https://github.com/helm/chart-releaser/issues/183
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: sigstore/cosign-installer@main
scottrigby marked this conversation as resolved.
Show resolved Hide resolved
- name: Push charts to GHCR
env:
COSIGN_EXPERIMENTAL: 1
# when filling gaps with previously released charts, cr would create
# nothing in .cr-release-packages/, and the original globbing character
# would be preserved, causing a non-zero exit. Set nullglob to fix this
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts
scottrigby marked this conversation as resolved.
Show resolved Hide resolved
file=${pkg##*/}
name=${file%-*}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need quotes here as well? Could $file contain spaces?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to quote the bash var expansion syntax. I ran actionlint locally, and shellcheck (which it uses to check this part) – only those lines needed love 😄

version=${file%.*}
version=${version#*-}
cosign sign ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts/"${name}":"${version}"
scottrigby marked this conversation as resolved.
Show resolved Hide resolved
done