|
| 1 | +name: Release Images and Charts |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: |
| 6 | + - "created" |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - 'rel-test' |
| 10 | + |
| 11 | +jobs: |
| 12 | + release-images-and-chart: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - uses: cachix/install-nix-action@v22 |
| 19 | + - name: Pre-populate nix-shell |
| 20 | + run: | |
| 21 | + export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) |
| 22 | + echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV |
| 23 | + nix-shell --pure --run "echo" ./shell.nix |
| 24 | +
|
| 25 | + - name: Set Image Org |
| 26 | + run: | |
| 27 | + [ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG }} |
| 28 | + echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV |
| 29 | +
|
| 30 | + - name: Log in to GHCR for Helm |
| 31 | + run: nix-shell --pure --run "echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin" ./shell.nix |
| 32 | + |
| 33 | + - name: Pull OCI chart from GHCR |
| 34 | + env: |
| 35 | + IMAGE_ORG: ${{ env.IMAGE_ORG }} |
| 36 | + RAW_TAG: ${{ github.ref_name }} |
| 37 | + run: | |
| 38 | + TAG="${RAW_TAG#v}" |
| 39 | + echo "Using chart version: $TAG" |
| 40 | +
|
| 41 | + rm -rf deploy/helm/charts |
| 42 | + mkdir -p charts-staged charts-final deploy/helm/charts |
| 43 | +
|
| 44 | + CHART_REF=oci://ghcr.io/${IMAGE_ORG}/helm/localpv-provisioner |
| 45 | + helm pull "$CHART_REF" \ |
| 46 | + --version "$TAG" \ |
| 47 | + --destination charts-staged |
| 48 | +
|
| 49 | + tar -xzf charts-staged/localpv-provisioner-"$TAG".tgz -C charts-final |
| 50 | +
|
| 51 | + mv charts-final/localpv-provisioner/* deploy/helm/charts |
| 52 | +
|
| 53 | + - name: Set Chart Version |
| 54 | + run: | |
| 55 | + echo "VERSION=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV |
| 56 | +
|
| 57 | + - name: Login to Docker Hub |
| 58 | + uses: docker/login-action@v3 |
| 59 | + with: |
| 60 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 61 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 62 | + |
| 63 | + - name: Login to Quay |
| 64 | + uses: docker/login-action@v3 |
| 65 | + with: |
| 66 | + registry: quay.io |
| 67 | + username: ${{ secrets.QUAY_USERNAME }} |
| 68 | + password: ${{ secrets.QUAY_TOKEN }} |
| 69 | + |
| 70 | + - name: Login to GHCR |
| 71 | + uses: docker/login-action@v3 |
| 72 | + with: |
| 73 | + registry: ghcr.io |
| 74 | + username: ${{ github.actor }} |
| 75 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + |
| 77 | + - name: Update the registry and the repository |
| 78 | + run: | |
| 79 | + nix-shell --pure --run "./scripts/update-reg-repo.sh --repository ${{ env.IMAGE_ORG }}/provisioner-localpv" ./shell.nix |
| 80 | +
|
| 81 | + |
| 82 | + with: |
| 83 | + name: localpv-provisioner |
| 84 | + repository: ${{ github.repository_owner }}/charts |
| 85 | + tag: ${{ env.VERSION }} |
| 86 | + path: ./deploy/helm/charts |
| 87 | + registry: ghcr.io |
| 88 | + registry_username: ${{ github.actor }} |
| 89 | + registry_password: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + update_dependencies: 'false' |
0 commit comments