Skip to content

Commit 8a3c91a

Browse files
authored
Merge pull request #1 from aboutbits/feature/initV1
Feature/init v1
2 parents f310611 + dfbffdb commit 8a3c91a

5 files changed

Lines changed: 111 additions & 17 deletions

File tree

deploy/action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'Deploy to Kubernetes'
2+
description: 'Deploy an application to a Kubernetes cluster'
3+
4+
inputs:
5+
working-directory:
6+
description: 'The working directory'
7+
default: '.'
8+
deployment-file:
9+
description: 'Deployment file for kubectl to apply'
10+
required: true
11+
namespace-name:
12+
description: 'Kubernetes namespace name'
13+
required: true
14+
deployment-name:
15+
description: 'Kubernetes deployment name'
16+
required: true
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Deploy to Kubernetes
22+
working-directory: ${{ inputs.working-directory }}
23+
run: kubectl apply -f ${{ inputs.deployment-file }}
24+
shell: bash
25+
26+
- name: Verify deployment
27+
id: verify
28+
run: kubectl rollout status -n ${{ inputs.namespace-name }} deployment/${{ inputs.deployment-name }}
29+
shell: bash
30+
31+
- name: Undo deployment if failed
32+
if: ${{ failure() && steps.verify.conclusion == 'failure' }}
33+
run: kubectl rollout undo -n ${{ inputs.namespace-name }} deployment/${{ inputs.deployment-name }}
34+
shell: bash

do-setup-kubectl/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Setup kubectl for DigitalOcean.'
2+
description: 'Setup DigitalOcean CLI and configure kubectl'
3+
4+
inputs:
5+
digital-ocean-token:
6+
description: 'Digital Ocean access token'
7+
required: true
8+
cluster-name:
9+
description: 'Kubernetes cluster name'
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Install doctl
16+
uses: digitalocean/action-doctl@v2
17+
with:
18+
token: ${{ inputs.digital-ocean-token }}
19+
20+
- name: Save DigitalOcean kubeconfig with short-lived credentials
21+
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ inputs.cluster-name }}
22+
shell: bash

license.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright About Bits GmbH
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

readme.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,61 @@
11
# GitHub Actions Kubernetes
22

3-
A collection of GitHub actions for Kubernetes projects.
3+
A collection of Kubernetes related GitHub actions.
44

5-
## Example Playbook
5+
## Actions
6+
7+
### Setup DigitalOcean
8+
9+
Setup Digital-Ocean CLI and configure Kubernetes.
10+
11+
#### Example
12+
13+
```yaml
14+
- uses: aboutbits/github-actions-kubernetes/do-setup-kubectl@v1
15+
with:
16+
digital-ocean-token: ${{ secrets.DIGITALOCEAN_TOKEN }}
17+
cluster-name: ${{ env.CLUSTER_NAME }}
18+
```
19+
20+
#### Inputs
21+
22+
The following inputs can be used as `step.with` keys:
23+
24+
| Name | Required/Default | Description |
25+
|--------------------------|--------------------|---------------------------------|
26+
| `digital-ocean-token` | required | Digital Ocean access token |
27+
| `cluster-name` | required | Kubernetes cluster name |
28+
29+
30+
### Deploy to Kubernetes
31+
32+
Deploy application to a Kubernetes Cluster. Requires Kubernetes to be configured first.
33+
34+
#### Example
635

736
```yaml
8-
- name: Build code
9-
uses: aboutbits/github-actions-kubernetes/xxx@v1
37+
- uses: aboutbits/github-actions-kubernetes/deploy@v1
1038
with:
11-
xxx-version: ${{ env.NODE_VERSION }}
39+
deployment-file: 'infrastructure/kubernetes.prod.yml'
40+
namespace-name: ${{ env.NAMESPACE_NAME }}
41+
deployment-name: ${{ env.DEPLOYMENT_NAME }}
1242
```
1343

44+
#### Inputs
45+
46+
The following inputs can be used as `step.with` keys:
47+
48+
| Name | Required/Default | Description |
49+
|------------------------|----------------------|--------------------------------------------|
50+
| `deployment-file` | required | Deployment file for kubectl to apply |
51+
| `namespace-name` | required | Kubernetes namespace name |
52+
| `deployment-name` | required | Kubernetes deployment name |
53+
| `working-directory` | `.` | The working directory |
54+
55+
1456
## Versioning
1557

16-
In order to have a verioning in place and working, create leightweight tags that point to the appropriate minor release versions.
58+
In order to have a versioning in place and working, create lightweight tags that point to the appropriate minor release versions.
1759

1860
Creating a new minor release:
1961

xxx/action.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)