diff --git a/README.md b/README.md index f3f37a5..e98841e 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,23 @@ To use kubectl put this step into your workflow: args: get pods ``` +### Using kubectl ouput +```yaml + - run: echo "EXPECTED_NAMESPACE=namespace/$NAMESPACE" >> $GITHUB_ENV + - name: 🛂 Check namespace exists + uses: actions-hub/kubectl@master + with: + redirect-to: NAMESPACE_EXIST + args: get namespace ${{ env.NAMESPACE }} -o name --ignore-not-found + + - name: 🛡️ Preserve secret WEBAPP_TLS + if: env.NAMESPACE_EXIST == env.EXPECTED_NAMESPACE + uses: actions-hub/kubectl@master + with: + redirect-to: WEBAPP_TLS + args: get secret webapp-tls -n ${{ env.NAMESPACE }} -o yaml +``` + ## Environment variables All these variables need to authorize to kubernetes cluster. I recommend using secrets for this. @@ -125,4 +142,4 @@ To use a specific version of kubectl use: ``` ## Licence -[MIT License](https://github.com/actions-hub/kubectl/blob/master/LICENSE) \ No newline at end of file +[MIT License](https://github.com/actions-hub/kubectl/blob/master/LICENSE)