Skip to content

Commit

Permalink
feat(ci/release): adjust release workflow (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau authored Jan 18, 2024
1 parent dcfa13c commit 5c38601
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 55 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/label-release-pr.yaml

This file was deleted.

55 changes: 30 additions & 25 deletions .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,43 @@ on:
branches:
- main
paths:
- charts/*/Chart.yaml
- .github/release-please/manifest.json

jobs:
getChangedChart:
if: ${{ contains(github.event.head_commit.message, '[bot] release') || github.event.name != 'push' }}
uses: ./.github/workflows/get-changed-chart.yaml
release:
if: ${{ contains(github.event.head_commit.message, '[bot] release') || github.event.name != 'push' }}
release_please:
runs-on: ubuntu-latest
needs: getChangedChart
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
paths_released: ${{ steps.release.outputs.paths_released }}
steps:
- uses: actions/checkout@v4

- run: pip install yq
- name: Extract and add helm repos
id: helm-repos
env:
CHART: ${{ needs.getChangedChart.outputs.chart }}
run: |
set -ex
set -o pipefail
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
- 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}"

- uses: google-github-actions/release-please-action@v4
id: release
with:
skip-github-pull-request: true
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
release_helm:
runs-on: ubuntu-latest
needs: release_please
if: ${{ needs.release_please.outputs.releases_created }}
strategy:
matrix:
chart: ${{ fromJson(needs.release_please.outputs.paths_released) }}
env:
CHART: ${{ matrix.chart }}
steps:
- uses: actions/checkout@v4

- run: helm package --dependency-update "charts/${CHART}"
- run: helm registry login ghcr.io --username teutonet-bot --password ${{ secrets.ACTIONS_BOT_TOKEN }}
- run: helm push "${CHART}"-* "oci://ghcr.io/${GITHUB_REPOSITORY}"
abort:
runs-on: ubuntu-latest
needs: release_please
if: ${{ !needs.release_please.outputs.releases_created }}
steps:
- name: abort if no release was made
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}

0 comments on commit 5c38601

Please sign in to comment.