Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci/release): adjust release workflow #730

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}