Skip to content

Instantly share code, notes, and snippets.

@WyriHaximus
Created October 15, 2021 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WyriHaximus/b96d47d305b198aedbc0eb5ca292411d to your computer and use it in GitHub Desktop.
Save WyriHaximus/b96d47d305b198aedbc0eb5ca292411d to your computer and use it in GitHub Desktop.
name: Helm Diff
on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
- edited
- ready_for_review
- review_requested
jobs:
helm-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: 'Get Previous tag'
id: previousgittag
continue-on-error: true
uses: "WyriHaximus/github-action-get-previous-tag@v1"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Prep helm chart
run: |
mv ./.helm/zerotier/Chart.yaml ./.helm/zerotier/Chart.old.yaml &&
cat ./.helm/zerotier/Chart.old.yaml | grep -v appVersion > ./.helm/zerotier/Chart.yaml &&
rm ./.helm/zerotier/Chart.old.yaml
echo -e "\r\nappVersion: ${{ steps.previousgittag.outputs.tag }}\r\n" >> ./.helm/zerotier/Chart.yaml &&
cat ./.helm/zerotier/Chart.yaml
- name: Deploy
uses: WyriHaximus/github-action-helm3@v2
id: diff
with:
exec: |
helm plugin install https://github.com/databus23/helm-diff
OUTPUT=$(helm diff upgrade zerotier ./.helm/zerotier --namespace zerotier --no-color)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=diff::$OUTPUT"
kubeconfig: '${{ secrets.KUBECONFIG }}'
- name: 'Upsert comment'
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
Helm Diff:
```diff
${{ steps.diff.outputs.diff }}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment