Created
October 15, 2021 10:22
-
-
Save WyriHaximus/b96d47d305b198aedbc0eb5ca292411d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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