Merge branch 'full-chart' #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Helm charts to OCI Registry | |
on: | |
push: | |
branches: | |
- main | |
# Publish when a new tag is pushed | |
tags: | |
- 'v*' | |
# Allow manual trigger | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: 'latest' | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up chart-releaser | |
uses: helm/[email protected] | |
with: | |
install_only: true | |
- name: Set up tags | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
# Default version for non-tag builds | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
echo "CHARTS_VERSION=0.0.0-${GITHUB_SHA::8}" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
echo "CHARTS_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
else | |
echo "CHARTS_VERSION=0.0.0-dev" >> $GITHUB_ENV | |
fi | |
- name: Package and push OpenCloud chart | |
run: | | |
# Update Chart.yaml version if we have a tag | |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
echo "Updating chart version to ${{ env.CHARTS_VERSION }}" | |
sed -i "s/^version:.*/version: ${{ env.CHARTS_VERSION }}/" charts/opencloud/Chart.yaml | |
fi | |
# Package Helm chart | |
helm package charts/opencloud | |
# Push to GHCR | |
helm push opencloud-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts/ | |
# Verify the pushed chart | |
echo "Verifying the pushed chart..." | |
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/opencloud --version $(helm show chart charts/opencloud | grep version | awk '{print $2}') | |
- name: Package and push OpenCloud Dev chart | |
run: | | |
# Update Chart.yaml version if we have a tag | |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
echo "Updating chart version to ${{ env.CHARTS_VERSION }}" | |
sed -i "s/^version:.*/version: ${{ env.CHARTS_VERSION }}/" charts/opencloud-dev/Chart.yaml | |
fi | |
# Package Helm chart | |
helm package charts/opencloud-dev | |
# Push to GHCR | |
helm push opencloud-dev-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts/ | |
# Verify the pushed chart | |
echo "Verifying the pushed chart..." | |
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/opencloud-dev --version $(helm show chart charts/opencloud-dev | grep version | awk '{print $2}') | |
- name: Package and push OpenCloud Full chart | |
run: | | |
# Update Chart.yaml version if we have a tag | |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
echo "Updating chart version to ${{ env.CHARTS_VERSION }}" | |
sed -i "s/^version:.*/version: ${{ env.CHARTS_VERSION }}/" charts/opencloud-full/Chart.yaml | |
fi | |
# Package Helm chart | |
helm package charts/opencloud-full | |
# Push to GHCR | |
helm push opencloud-full-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts/ | |
# Verify the pushed chart | |
echo "Verifying the pushed chart..." | |
helm pull oci://ghcr.io/${{ github.repository_owner }}/helm-charts/opencloud-full --version $(helm show chart charts/opencloud-full | grep version | awk '{print $2}') |