mirror of
https://github.com/auricom/home-cluster.git
synced 2025-12-30 18:27:26 +01:00
🚀 update github workflows
This commit is contained in:
91
.github/workflows/helmrelease-diff.yaml
vendored
Normal file
91
.github/workflows/helmrelease-diff.yaml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
name: "HelmRelease Diff"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths: ["kubernetes/**/helmrelease.yaml"]
|
||||
|
||||
env:
|
||||
BOT_USERNAME: rosey-bot[bot]
|
||||
KUBERNETES_DIR: kubernetes/
|
||||
|
||||
jobs:
|
||||
changed-files:
|
||||
name: Detect File Changes
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@0626c3f94002c0a9d7491dd7fed7055bbdff6f92 # v35.1.0
|
||||
with:
|
||||
json: true
|
||||
files: |
|
||||
kubernetes/**/helmrelease.yaml
|
||||
- id: set-matrix
|
||||
run: echo "matrix={\"file\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
diff:
|
||||
name: Diff on Helm Releases
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files]
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
||||
|
||||
- name: Checkout default branch
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
||||
with:
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
path: default
|
||||
|
||||
- name: Generate Token
|
||||
uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c # renovate: tag=v1.7.0
|
||||
id: generate-token
|
||||
with:
|
||||
app_id: ${{ secrets.BOT_APP_ID }}
|
||||
private_key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
|
||||
|
||||
- name: Set up Homebrew
|
||||
uses: Homebrew/actions/setup-homebrew@master
|
||||
|
||||
- name: Setup Tools
|
||||
run: |
|
||||
brew install helm homeport/tap/dyff kustomize yq
|
||||
- name: Diff
|
||||
id: diff
|
||||
run: |
|
||||
diff=$(npx zx ./.github/scripts/helmReleaseDiff.mjs \
|
||||
--current-release "default/${{ matrix.file }}" \
|
||||
--incoming-release "${{ matrix.file }}" \
|
||||
--kubernetes-dir ${{ env.KUBERNETES_DIR }})
|
||||
echo "diff<<EOF" >> "${GITHUB_OUTPUT}"
|
||||
echo "${diff}" >> "${GITHUB_OUTPUT}"
|
||||
echo "EOF" >> "${GITHUB_OUTPUT}"
|
||||
- name: Find Comment
|
||||
uses: peter-evans/find-comment@81e2da3af01c92f83cb927cf3ace0e085617c556 # v2.2.0
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: ${{ env.BOT_USERNAME }}
|
||||
body-includes: ${{ matrix.file }}
|
||||
|
||||
- name: Create or update comment
|
||||
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808 # renovate: tag=v2.1.0
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
Helm Release: `${{ matrix.file }}`
|
||||
```
|
||||
${{ steps.diff.outputs.diff }}
|
||||
```
|
||||
edit-mode: replace
|
||||
Reference in New Issue
Block a user