From 782953ba0634e151a396029c38a8ac757c76cd18 Mon Sep 17 00:00:00 2001 From: Michael Schenck Date: Mon, 10 Oct 2022 17:03:12 -0400 Subject: [PATCH] separated docker and helm release, helm now only triggers when a merge to main includes a change to the Chart.yaml --- .github/workflows/docker_release.yaml | 34 ++++++++++ .github/workflows/helm_release.yaml | 37 ++++++++++ .github/workflows/release.yaml | 98 --------------------------- 3 files changed, 71 insertions(+), 98 deletions(-) create mode 100644 .github/workflows/docker_release.yaml create mode 100644 .github/workflows/helm_release.yaml delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/docker_release.yaml b/.github/workflows/docker_release.yaml new file mode 100644 index 00000000..39031c79 --- /dev/null +++ b/.github/workflows/docker_release.yaml @@ -0,0 +1,34 @@ +name: Docker Release + +on: + push: + branches: + - main + # TODO: Should be scoped to tag pushes eventually + +jobs: + docker_release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ngrok/ngrok-ingress-controller:latest diff --git a/.github/workflows/helm_release.yaml b/.github/workflows/helm_release.yaml new file mode 100644 index 00000000..caef1c33 --- /dev/null +++ b/.github/workflows/helm_release.yaml @@ -0,0 +1,37 @@ +name: Helm Release + +on: + push: + branches: + - main + - mschenck/12686/helm-release-workflow + paths: + - 'helm/ingress-controller/Chart.yaml' + +jobs: + helm_release: + needs: helm_bump_version + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + with: + version: v3.10.0 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.4.1 + with: + charts_dir: helm + env: + CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 81661e12..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,98 +0,0 @@ -name: Release - -on: - push: - branches: - - main - # TODO: Should be scoped to tag pushes eventually - -jobs: - docker_release: - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: . - push: true - tags: ngrok/ngrok-ingress-controller:latest - - helm_bump_version: - needs: docker_release - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Read Helm Chart Version - id: helm_chart - uses: jacobtomlinson/gha-read-helm-chart@master - with: - path: helm/ingress-controller - - - name: Increment Semver Patch-level - id: next_version - uses: "WyriHaximus/github-action-next-semvers@v1" - with: - version: "${{ steps.helm_chart.outputs.version }}" - - - name: Update Chart version - uses: jacobtomlinson/gha-find-replace@v2 - with: - include: "helm/ingress-controller/Chart.yaml" - find: '(?m)^version: .*$' - replace: "version: ${{ steps.next_version.outputs.patch }}" - - - name: Commit Chart.yaml version bump - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Increment (patch-level) chart version - - helm_release: - needs: helm_bump_version - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Install Helm - uses: azure/setup-helm@v3 - with: - version: v3.10.0 - - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.4.1 - with: - charts_dir: helm - env: - CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}