update artifacthub metadata #153
This file contains 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: Release Charts | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'charts/**' | |
jobs: | |
# Generate the values for charts with changes | |
generate-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- id: files | |
uses: tj-actions/changed-files@v41 | |
- name: Generate Matrix Content | |
id: generate-matrix | |
run: | | |
changed=`echo "${{ steps.files.outputs.all_changed_files }}" | sed 's/ /\n/g' | grep charts | cut -f2 -d'/' | uniq | sed 's/^/"/;s/$/"/' | sed -z 's/\n/,/g;s/,$/\n/'` | |
echo "::set-output name=matrix::{ \"chart\": [ ${changed} ] }" | |
chart-release: | |
needs: generate-matrix | |
runs-on: ubuntu-latest | |
env: | |
registry: registry-1.docker.io/gradiantcharts | |
strategy: | |
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.16.0 | |
- name: Login to OCI Registry | |
run: | | |
echo "Attempting to login to registry $registry" | |
helm registry login -u $username -p $password $registry | |
env: | |
username: ${{ secrets.OCI_USERNAME }} | |
password: ${{ secrets.OCI_PASSWORD }} | |
- name: push chart | |
id: push | |
run: | | |
echo "Packaging chart '${{ matrix.chart }}'..." | |
helm dep update charts/${{ matrix.chart }} | |
helm package charts/${{ matrix.chart }} | |
echo "Push package '${{ matrix.chart }}' to $registry ..." | |
helm push ${{ matrix.chart }}*.tgz oci://$registry | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.OCI_USERNAME }} | |
password: ${{ secrets.OCI_PASSWORD }} | |
- name: push metadata | |
id: push-metadata | |
run: | | |
echo "Pushing '${{ matrix.chart }}' metadata for artifacthub.io ..." | |
oras push \ | |
$registry/${{ matrix.chart }}:artifacthub.io \ | |
--config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \ | |
charts/${{ matrix.chart }}/artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml |