diff --git a/do-setup-kubectl/action.yml b/do-setup-kubectl/action.yml deleted file mode 100644 index 49c1c48..0000000 --- a/do-setup-kubectl/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'Setup kubectl for DigitalOcean.' -description: 'Setup DigitalOcean CLI and configure kubectl' - -inputs: - digital-ocean-token: - description: 'DigitalOcean access token' - required: true - cluster-name: - description: 'Kubernetes cluster name' - required: true - helm-version: - description: 'Helm version' - required: false - default: '3.17.1' - - -runs: - using: "composite" - steps: - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ inputs.digital-ocean-token }} - - - name: Save DigitalOcean kubeconfig with short-lived credentials - run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ inputs.cluster-name }} - shell: bash - - - name: Setup Helm - uses: azure/setup-helm@v4.2.0 - with: - version: ${{ inputs.helm-version }} diff --git a/readme.md b/readme.md index bf0849d..41b1812 100644 --- a/readme.md +++ b/readme.md @@ -4,29 +4,27 @@ A collection of Kubernetes related GitHub actions. ## Actions -### Setup DigitalOcean +### Setup kubectl and Helm -Setup Digital-Ocean CLI and configure Kubernetes. +Setup kubectl and Helm using kubeconfig file. #### Example ```yaml - - uses: aboutbits/github-actions-kubernetes/do-setup-kubectl@v2 + - uses: aboutbits/github-actions-kubernetes/setup-kubectl-and-helm@v3 with: - digital-ocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }} - cluster-name: ${{ env.CLUSTER_NAME }} + kubeconfig: ${{ secrets.KUBECONFIG }} ``` #### Inputs The following inputs can be used as `step.with` keys: -| Name | Required/Default | Description | -|-----------------------|------------------|----------------------------------------| -| `digital-ocean-token` | required | DigitalOcean access token | -| `cluster-name` | required | Kubernetes cluster name | -| `helm-version` | `3.17.1` | The version of Helm to install and use | - +| Name | Required/Default | Description | +|----------------|------------------|-----------------------------| +| `kubeconfig` | required | The kubeconfig file content | +| `kube-version` | `1.33.1` | The version of kubectl | +| `helm-version` | `3.17.3` | The version of Helm | ### Deploy to Kubernetes using kubectl @@ -35,7 +33,7 @@ Deploy application to a Kubernetes Cluster. Requires Kubernetes to be configured #### Example ```yaml - - uses: aboutbits/github-actions-kubernetes/kubectl-deploy@v2 + - uses: aboutbits/github-actions-kubernetes/kubectl-deploy@v3 with: deployment-file: 'infrastructure/kubernetes.prod.yml' namespace-name: ${{ env.NAMESPACE_NAME }} @@ -60,7 +58,7 @@ Deploy an application to a Kubernetes cluster using its Helm chart. Requires Kub #### Example ```yaml - - uses: aboutbits/github-actions-kubernetes/helm-deploy@v2 + - uses: aboutbits/github-actions-kubernetes/helm-deploy@v3 with: helm-chart-version: "1.0.0" helm-package: "my-app-chart" @@ -99,16 +97,16 @@ In order to have a versioning in place and working, create lightweight tags that Creating a new minor release: ```bash -git tag v2 +git tag v3 git push --tags ``` Replacing an already existing minor release: ```bash -git tag -d v2 -git push origin :refs/tags/v2 -git tag v2 +git tag -d v3 +git push origin :refs/tags/v3 +git tag v3 git push --tags ``` diff --git a/setup-kubectl-and-helm/action.yml b/setup-kubectl-and-helm/action.yml new file mode 100644 index 0000000..8f54b89 --- /dev/null +++ b/setup-kubectl-and-helm/action.yml @@ -0,0 +1,34 @@ +name: 'Setup kubectl and Helm.' +description: 'Setup kubectl and Helm using kubeconfig file.' + +inputs: + kubeconfig: + description: 'The kubeconfig file content' + required: true + kubectl-version: + description: 'kubectl version' + required: false + default: '1.33.1' + helm-version: + description: 'Helm version' + required: false + default: '3.17.3' + +runs: + using: "composite" + steps: + - name: Setup kubectl + uses: azure/setup-kubectl@v4 + with: + version: ${{ inputs.kubectl-version }} + + - name: Setup kubeconfig file + run: | + mkdir -p ~/.kube + echo "${{ inputs.kubeconfig }}" > ~/.kube/config + chmod 600 ~/.kube/config + + - name: Setup Helm + uses: azure/setup-helm@v4 + with: + version: ${{ inputs.helm-version }}