From eb64f8b5cca26978eb73d29951d8a35a8c0a97b2 Mon Sep 17 00:00:00 2001 From: Chris Werner Rau Date: Wed, 20 Dec 2023 07:49:26 +0100 Subject: [PATCH] feat(ci): create release via release-please (#663) --- .github/cr.yaml | 2 -- .github/workflows/create-release-pr.yaml | 12 ++++---- .github/workflows/release-chart.yaml | 38 ++++++++++-------------- 3 files changed, 22 insertions(+), 30 deletions(-) delete mode 100644 .github/cr.yaml diff --git a/.github/cr.yaml b/.github/cr.yaml deleted file mode 100644 index 1a31b7604..000000000 --- a/.github/cr.yaml +++ /dev/null @@ -1,2 +0,0 @@ -generate-release-notes: true -make-release-latest: false diff --git a/.github/workflows/create-release-pr.yaml b/.github/workflows/create-release-pr.yaml index 839e739e7..e2bd9ba28 100644 --- a/.github/workflows/create-release-pr.yaml +++ b/.github/workflows/create-release-pr.yaml @@ -58,12 +58,12 @@ jobs: - uses: google-github-actions/release-please-action@v3 with: path: charts/${{ inputs.chart }} - token: ${{ secrets.ACTIONS_BOT_TOKEN }} - release-type: helm - monorepo-tags: true - changelog-types: '[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Miscellaneous Chores"}]' - pull-request-title-pattern: "chore${scope}: [bot] release${component}:${version}" - separate-pull-requests: true package-name: ${{ inputs.chart }} command: release-pr + changelog-types: '[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Miscellaneous Chores"}]' last-release-sha: ${{ steps.getLatestReleaseHash.outputs.hash }} + monorepo-tags: true + pull-request-title-pattern: "chore${scope}: [bot] release${component}:${version}" + release-type: helm + separate-pull-requests: true + token: ${{ secrets.ACTIONS_BOT_TOKEN }} diff --git a/.github/workflows/release-chart.yaml b/.github/workflows/release-chart.yaml index 59a5a9fe9..a90764c76 100644 --- a/.github/workflows/release-chart.yaml +++ b/.github/workflows/release-chart.yaml @@ -18,38 +18,32 @@ jobs: needs: getChangedChart steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.ACTIONS_BOT_TOKEN }} - - - name: Configure Git - run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - run: pip install yq - - name: Extract and add helm repos and single out the changed chart + - name: Extract and add helm repos id: helm-repos env: CHART: ${{ needs.getChangedChart.outputs.chart }} run: | set -ex set -o pipefail - mkdir changed_charts chart_dir="charts/${CHART}" file="${chart_dir}/Chart.yaml" yq -r '.dependencies[] | .repository' "$file" | sort -u | awk '{print NR " " $1}' | xargs -r -n 2 helm repo add - mv "${chart_dir}" changed_charts/ - rm -rf charts - mv changed_charts charts - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - env: - CR_TOKEN: "${{ secrets.ACTIONS_BOT_TOKEN }}" - config: .github/cr.yaml - - name: Login to GitHub Container Registry + - run: helm package --dependency-update charts/${{ needs.getChangedChart.outputs.chart }} + - run: helm registry login ghcr.io --username teutonet-bot --password ${{ secrets.ACTIONS_BOT_TOKEN }} + - run: helm push ${{ needs.getChangedChart.outputs.chart }}-* "oci://ghcr.io/${GITHUB_REPOSITORY}" + - name: Change to github-actions[bot] run: | - helm registry login ghcr.io --username teutonet-bot --password ${{ secrets.ACTIONS_BOT_TOKEN }} - - name: push chart to GHCR - run: helm push .cr-release-packages/${{ needs.getChangedChart.outputs.chart }}-* "oci://ghcr.io/${GITHUB_REPOSITORY}" + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - uses: google-github-actions/release-please-action@v3 + with: + path: charts/${{ needs.getChangedChart.outputs.chart }} + package-name: ${{ needs.getChangedChart.outputs.chart }} + command: github-release + changelog-types: '[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Miscellaneous Chores"}]' + release-type: helm + token: ${{ secrets.ACTIONS_BOT_TOKEN }}