Skip to content

Commit e6325e2

Browse files
authored
Adjust Github Actions to use Helm deployment (#2)
* setup helm as part of the overall setup * add action to deploy app using helm * use latest for azure/setup-helm * add docs * cleanup action * add --wait flag * rename to helm-deploy * rename to kubectl-deploy * adjust docs * adjust readme to reflect new versions * fix typo in description * adjust type for deploy with kubectl
1 parent 8a3c91a commit e6325e2

4 files changed

Lines changed: 73 additions & 7 deletions

File tree

do-setup-kubectl/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ runs:
2020
- name: Save DigitalOcean kubeconfig with short-lived credentials
2121
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ inputs.cluster-name }}
2222
shell: bash
23+
24+
- name: Setup helm
25+
uses: azure/setup-helm@v4.2.0

helm-deploy/action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Deploy Helm chart to Kubernetes'
2+
description: 'Deploy an application to a Kubernetes cluster using its Helm chart'
3+
4+
inputs:
5+
release-name:
6+
description: 'The name of the Helm release'
7+
required: true
8+
chart-path:
9+
description: 'The directory of the Helm chart'
10+
default: '.'
11+
values-file:
12+
description: 'Path to the Helm values file'
13+
required: true
14+
image-tag:
15+
description: 'Tag of the container image'
16+
default: 'latest'
17+
timeout:
18+
description: 'Timeout for the Helm command'
19+
default: '5m'
20+
working-directory:
21+
description: 'The working directory'
22+
default: '.'
23+
24+
runs:
25+
using: "composite"
26+
steps:
27+
- name: Deploy Helm Chart
28+
shell: bash
29+
working-directory: ${{ inputs.working-directory }}
30+
run: |
31+
helm upgrade --wait --install ${{ inputs.release-name }} ${{ inputs.chart-path }} \
32+
--values ${{ inputs.values-file }} \
33+
--atomic --timeout ${{ inputs.timeout }} \
34+
--set image.tag=${{ inputs.image-tag }}

readme.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Setup Digital-Ocean CLI and configure Kubernetes.
1111
#### Example
1212

1313
```yaml
14-
- uses: aboutbits/github-actions-kubernetes/do-setup-kubectl@v1
14+
- uses: aboutbits/github-actions-kubernetes/do-setup-kubectl@v2
1515
with:
1616
digital-ocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }}
1717
cluster-name: ${{ env.CLUSTER_NAME }}
@@ -27,14 +27,14 @@ The following inputs can be used as `step.with` keys:
2727
| `cluster-name` | required | Kubernetes cluster name |
2828

2929

30-
### Deploy to Kubernetes
30+
### Deploy to Kubernetes using kubectl
3131

3232
Deploy application to a Kubernetes Cluster. Requires Kubernetes to be configured first.
3333

3434
#### Example
3535

3636
```yaml
37-
- uses: aboutbits/github-actions-kubernetes/deploy@v1
37+
- uses: aboutbits/github-actions-kubernetes/kubectl-deploy@v2
3838
with:
3939
deployment-file: 'infrastructure/kubernetes.prod.yml'
4040
namespace-name: ${{ env.NAMESPACE_NAME }}
@@ -52,6 +52,35 @@ The following inputs can be used as `step.with` keys:
5252
| `deployment-name` | required | Kubernetes deployment name |
5353
| `working-directory` | `.` | The working directory |
5454

55+
### Deploy to Kubernetes using Helm
56+
57+
Deploy an application to a Kubernetes cluster using its Helm diagram. Requires Kubernetes to be configured first.
58+
59+
#### Example
60+
61+
```yaml
62+
- uses: aboutbits/github-actions-kubernetes/helm-deploy@v2
63+
with:
64+
release-name: my-app
65+
chart-directory: my-chart
66+
image-tag: "1.0.0"
67+
values-file: environments/values-test.yaml
68+
timeout: 5m
69+
working-directory: ./infrastructure
70+
```
71+
72+
#### Inputs
73+
74+
The following inputs can be used as `step.with` keys:
75+
76+
| Name | Required/Default | Description |
77+
|---------------------|------------------|------------------------------------|
78+
| `release-name` | required | The name of the Helm release |
79+
| `values-file` | required | Path to the Helm values file |
80+
| `working-directory` | `.` | The working directory |
81+
| `chart-directory` | `.` | Root directory of the helm diagram |
82+
| `image-tag` | `latest` | Tag of the container image |
83+
| `timeout` | `5m` | Timeout for the Helm command |
5584

5685
## Versioning
5786

@@ -60,16 +89,16 @@ In order to have a versioning in place and working, create lightweight tags that
6089
Creating a new minor release:
6190

6291
```bash
63-
git tag v1
92+
git tag v2
6493
git push --tags
6594
```
6695

6796
Replacing an already existing minor release:
6897

6998
```bash
70-
git tag -d v1
71-
git push origin :refs/tags/v1
72-
git tag v1
99+
git tag -d v2
100+
git push origin :refs/tags/v2
101+
git tag v2
73102
git push --tags
74103
```
75104

0 commit comments

Comments
 (0)