From 980d17526615f5c7c44064c8510f50b8af2eaafa Mon Sep 17 00:00:00 2001 From: Roy Hadad <39004075+royhadad@users.noreply.github.com> Date: Wed, 31 May 2023 17:55:32 +0300 Subject: [PATCH] ci: move release helm chart to helm chart release (#364) --- .github/workflows/release_to_prod.yaml | 24 ---------------- .../reusable_release_helm_chart.yaml | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release_to_prod.yaml b/.github/workflows/release_to_prod.yaml index 3e5aaf93..4860b1c8 100644 --- a/.github/workflows/release_to_prod.yaml +++ b/.github/workflows/release_to_prod.yaml @@ -65,27 +65,3 @@ jobs: run: | echo "Cloudfront: Invalidating /*" AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" - update-docs: - runs-on: ubuntu-latest - name: update docs after the release - needs: release-docker - steps: - - uses: actions/checkout@v3 - with: - token: ${{secrets.DATREE_CI_GH_TOKEN}} - repository: datreeio/docs - - name: Replace version in docs - run: | - sed -E 's/datree-admission-webhook --revision [0-9.]+/datree-admission-webhook --revision ${{ steps.define_version.outputs.version }}/' ./docs/welcome/getting-started/index.mdx > ~/getting_started_index_temp.mdx && mv ~/getting_started_index_temp.mdx ./docs/welcome/getting-started/index.mdx - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - token: ${{secrets.DATREE_CI_GH_TOKEN}} - commit-message: "docs: update webhook version to ${{ steps.define_version.outputs.version }}" - title: "docs: update webhook version to ${{ steps.define_version.outputs.version }}" - body: "docs: update webhook version to ${{ steps.define_version.outputs.version }}" - branch: "docs/update-webhook-version-${{ steps.define_version.outputs.version }}" - branch-suffix: "timestamp" - delete-branch: true - labels: "docs" - reviewers: "datreeio/product" diff --git a/.github/workflows/reusable_release_helm_chart.yaml b/.github/workflows/reusable_release_helm_chart.yaml index 75d4dda0..ea78ecbd 100644 --- a/.github/workflows/reusable_release_helm_chart.yaml +++ b/.github/workflows/reusable_release_helm_chart.yaml @@ -8,6 +8,8 @@ jobs: permissions: contents: write runs-on: ubuntu-latest + outputs: + chart_version: ${{ steps.set_chart_version.outputs.chart_version }} steps: - name: Checkout uses: actions/checkout@v3 @@ -23,9 +25,11 @@ jobs: with: version: v3.10.0 - name: Set Chart Version env + id: set_chart_version run: | NEW_CHART_VERSION=$(yq e '.version' ./charts/datree-admission-webhook/Chart.yaml | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') echo "NEW_CHART_VERSION=$NEW_CHART_VERSION" >> $GITHUB_ENV + echo "chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT - name: Custom bump versions uses: mikefarah/yq@master with: @@ -39,3 +43,27 @@ jobs: uses: helm/chart-releaser-action@v1.4.1 env: CR_TOKEN: "${{ secrets.DATREE_CI_GH_TOKEN }}" + update-docs: + runs-on: ubuntu-latest + name: update docs after the release + needs: release + steps: + - uses: actions/checkout@v3 + with: + token: ${{secrets.DATREE_CI_GH_TOKEN}} + repository: datreeio/docs + - name: Replace version in docs + run: | + sed -E 's/datree-admission-webhook --revision [0-9.]+/datree-admission-webhook --revision ${{ needs.release.outputs.chart_version }}/' ./docs/welcome/getting-started/index.mdx > ~/getting_started_index_temp.mdx && mv ~/getting_started_index_temp.mdx ./docs/welcome/getting-started/index.mdx + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{secrets.DATREE_CI_GH_TOKEN}} + commit-message: "docs: update webhook version to ${{ needs.release.outputs.chart_version }}" + title: "docs: update webhook version to ${{ needs.release.outputs.chart_version }}" + body: "docs: update webhook version to ${{ needs.release.outputs.chart_version }}" + branch: "docs/update-webhook-version-${{ needs.release.outputs.chart_version }}" + branch-suffix: "timestamp" + delete-branch: true + labels: "docs" + reviewers: "datreeio/product"