Skip to content

Commit

Permalink
Merge pull request #297 from Danil-Grigorev/fix-nightly-chart-publish
Browse files Browse the repository at this point in the history
🐛 Fix failing nightly chart publish job
  • Loading branch information
alexander-demicev authored Dec 5, 2023
2 parents 9985847 + 5cf8372 commit fa03c00
Showing 1 changed file with 14 additions and 42 deletions.
56 changes: 14 additions & 42 deletions .github/workflows/nightly-chart-and-image-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ on:
env:
TAG: v0.0.0-${{ github.sha }}
REGISTRY: ghcr.io
PROD_REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
PROD_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
PROD_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
PROD_ORG: rancher-sandbox

jobs:
build-ghcr:
build-and-publish-ghcr:
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -35,14 +32,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
run: make docker-build-all TAG=${{ env.TAG }}
run: make docker-build-all TAG=${{ env.TAG }} ORG=${{ env.PROD_ORG }}
- name: Push docker image
run: make docker-push-all TAG=${{ env.TAG }}
run: make docker-push-all TAG=${{ env.TAG }} ORG=${{ env.PROD_ORG }}

publish-helm-chart-ghcr:
name: Publish Helm chart to GHCR
needs:
- build-ghcr
needs:
- build-and-publish-ghcr
permissions:
contents: read
packages: write
Expand All @@ -69,31 +66,6 @@ jobs:
run: |
helm push out/package/rancher-turtles-0.0.0-${{ github.sha }}.tgz oci://ghcr.io/${{ github.repository_owner }}/rancher-turtles-chart
publish-ghcr-helm-chart-oci-image:
name: Publish GHCR Helm chart as OCI image
needs:
- publish-helm-chart-ghcr
permissions:
contents: read
packages: write
env:
GHCR_REPOSITORY: ${{ github.repository_owner }}/rancher-turtles-chart
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Install Helm
uses: Azure/setup-helm@v3
with:
version: 3.8.0

- name: Publish Helm chart as OCI image to ghcr
run: |
helm chart export out/package/rancher-turtles-0.0.0-${{ github.sha }}.tgz oci://ghcr.io/${{ github.repository_owner }}/rancher-turtles-chart
build-and-publish-prod:
runs-on: ubuntu-latest
permissions:
Expand All @@ -111,16 +83,16 @@ jobs:
- name: Docker login to prod registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.PROD_REGISTRY_ENDPOINT }}
username: ${{ secrets.PROD_REGISTRY_USERNAME }}
password: ${{ secrets.PROD_REGISTRY_PASSWORD }}
registry: ${{ secrets.REGISTRY_ENDPOINT }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker image for prod registry
run: make docker-build-all TAG=${{ env.TAG }} REGISTRY=${{ secrets.PROD_REGISTRY_ENDPOINT }} ORG=${{ secrets.PROD_ORG }}
run: make docker-build-all TAG=${{ env.TAG }} REGISTRY=${{ secrets.REGISTRY_ENDPOINT }} ORG=${{ env.PROD_ORG }}
- name: Push Docker image to prod registry
run: make docker-push-all TAG=${{ env.TAG }} REGISTRY=${{ secrets.PROD_REGISTRY_ENDPOINT }} ORG=${{ secrets.PROD_ORG }}
run: make docker-push-all TAG=${{ env.TAG }} REGISTRY=${{ secrets.REGISTRY_ENDPOINT }} ORG=${{ env.PROD_ORG }}

build-and-publish-prod-helm-chart-oci-image:
name: Build Helm Chart and publish as OCI image to prod registry
publish-helm-chart-prod:
name: Publish OCI image of helm chart to prod registry
needs:
- build-and-publish-prod
permissions:
Expand All @@ -142,7 +114,7 @@ jobs:
run: make release-chart RELEASE_TAG=${{ env.TAG }}
- name: Login to prod registry using Helm
run: |
echo ${{ secrets.PROD_REGISTRY_PASSWORD }} | helm registry login ${{ secrets.PROD_REGISTRY_ENDPOINT }} --username ${{ secrets.PROD_REGISTRY_USERNAME }} --password-stdin
echo ${{ secrets.REGISTRY_PASSWORD }} | helm registry login ${{ secrets.REGISTRY_ENDPOINT }} --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin
- name: Publish Helm chart as OCI image to prod registry
run: |
helm push out/package/rancher-turtles-0.0.0-${{ github.sha }}.tgz oci://$${{ secrets.PROD_REGISTRY_ENDPOINT }}/$${{ secrets.PROD_ORG }}/rancher-turtles-chart
helm push out/package/rancher-turtles-0.0.0-${{ github.sha }}.tgz oci://${{ secrets.REGISTRY_ENDPOINT }}/${{ env.PROD_ORG }}/rancher-turtles-chart

0 comments on commit fa03c00

Please sign in to comment.